Professional Documents
Culture Documents
National University of Modern Languages (Numl)
National University of Modern Languages (Numl)
ASSIGNMENT # 1
SUBMITTED BY : M.ABUBAKER
DATE: 22-03-2021
QUESTION 1.
Declare the header files. Then define the main function. Then use the
cout statement to print the required message.
#include <iostream>
{cout<<"Hello world";
return 0;
QUESTION 2.
Write a Program To Assign Values To Different Variables (Atleast One
Value For Each Variable Type).At The Time Of Declaration. Print The
Assigned Values On The Computer Screen.
#include <iostream>
int main ()
cout << "float: " <<decimal<<endl; cout << "double: " <<decimal2<<endl;
cout << "character: " <<alphabet<<endl; cout << "string: " <<message<<endl;
return 0;
QUESTION 3.
Write a program to perform arithematic operation by using all
arthematic operators. Also print result on the screen.
#include <iostream>
int main()
{
int a=90;
int b=60;
int c=40;
int d=20;
float q,w,e,r,t,y,u,i,o,p,m,s;
q=c+b;
w=d-b;
e=a*c;
r=b/c;
t=++d;
y=--c;
u=d%c;
i=b+=a;
o=a-=d;
p=b/=c;
m=a*=d;
s=c%=b;
cout<<"addition: "<<q<<endl;
cout<<"subtraction: "<<w<<endl;
cout<<"multiplication: "<<e<<endl;
cout<<"division: "<<r<<endl;
cout<<"increment"<<t<<endl;
cout<<"decrement"<<y<<endl;
cout<<"percentage: "<<u<<endl<<endl;
return 0;
}
QUESTION 4.
Write a program that calculate area and circumference
of circle(using pi as a floating constant) with the output
formatted in the following way
#include <iostream>
#define pi 3.14
int main()
float a,cir,radius;
cout<<"radius is";
cin>>radius;
a=pi*radius*radius;
cir=2*pi*radius;
return 0;
}
QUESTION 5.
Write a program to assign two variables by assignment
statement interchange the values and print the result on
screen.
#include <iostream>
int main ()
int x=50,y=34,temp;
cout<<"x="<<x<<"\ny="<<y;
temp=x;
x=y;
y=temp;
cout<<"\ny="<<y<<"\nx="<<x;
return 0;