You are on page 1of 9

Name; Syed Haider Abbas

Reg No;22108247

Subitted To;Dr Danish Mehmood


Fop Assignment # 1
Q No 1;
Display checkboard pattern with eight output statements, than
display the same pattern with as few output statements as
possible.

Code;
#include<iostream> using
namespace std;
int main()
{
cout<<”* * * * * * * * “<<endl;
cout<<” * * * * * * * * “<<endl;
cout<<”* * * * * * * * “<<endl;
cout<<” * * * * * * * * “<<endl;
cout<<”* * * * * * * * “<<endl;
cout<<” * * * * * * * * “<<endl;
cout<<”* * * * * * * * “<<endl;
cout<<” * * * * * * * * “<<endl; return
0;

}
Output;

Code 2;
#include <iostream>
using namespace std;
int main()
{
cout<<"* * * * * * * *\n * * * * * * * *\n* * * * * * * *\n * * * * * * * *\n* * * *
* * * *\n * * * * * * * *\n* * * * * * * *\n * * * * * * * *"<<endl;
return 0;
}
Output;
Output;
Q No 2;
Write a program or comment to accomplish
each of the following.
Code;
//program that input three values from user and than multiply the values
#include <iostream>
using namespace std;
int main() { int x; //declare
the variables int y; int z;
int Result;
cout<<"enter the value of x="<<endl;
cin>>x; //user input the values
cout<<"enter the value of y="<<endl;
cin>>y; cout<<"enter the value of
z="<<endl; cin>>z;
Result=x*y*z; //multiply the numbers cout<<"The
product is="<<Result; //display in the screen
return 0;
}
Output;
Output;
Q No 3;
Solve the following equation manually step
by step according toto operator precedence
in c++,also write the code to solve in using
dev c++ Code;
#include<iostream>
using namespace std; int
main()
{
float x,x1,x2;
x1=(15)*(2/3+10);
x2=(15)*(2/5+36/5); x=x1+x2;
cout<<"the result is="<<x;
return 0;
}
Output;

Manually;
x=(15)[(2/30+(10)] +(15)[(2/5)+(36/5)]
x=(15)[(32/3)+(38/50)]
x=480/3+570/5 x=255
Output;

You might also like