You are on page 1of 7

//Program1 : To display the use of various arithmetic operations

#include<iostream.h>
void main()
{
float num1=10,num2=5,add,sub,mul,div;
add=num1+num2;
cout<<”\nthe Sum of two numbers is=“<<add;
sub=num1-num2;
cout<<”\nthe difference of two numbers is=“<<sub;
mul=num1*num2;
cout<<”\nthe product of two numbers is=“<<mul;
div=num1/num2;
cout<<”\nthe quotient of two numbers is=“<<div;
}
//Program 2: To calculate and print the area of circle//

#include<iostream.h>
void main()
{
float radius=3,area;
area=3.14*radius*radius;
cout<<”\nArea of the circle is :”<<area;
}
//Program 3: To print the greatest of three numbers//

#include<iostream.h>
void main()
{
int n1,n2,n3;
cout<<”Enter three numbers\n”;
cin>>n1>>n2>>n3;
if(n1>n2 && n1>n3)
cout<<n1<<” is greatest of the three”;
else if(n2>n3)
cout<<n2<<” is greatest of the three”;
else
cout<<n3<<” is greatest of the three”;
}

You might also like