In this program, we shall talk about Arithmetic Operation to be performed using C++. This is a basic problem that every student is asked to solve in his preliminary classes of the Programming Course.
#include<iostream.h>
#include<conio.h>
void main()
{
int a=10;
int b=3;
int sum, difference, product, quotient;
sum=a+b;
difference=a-b;
product=a*b;
quotient=a/b;
cout<<"the sum of "<<a<<" & "<<b<<" is "<<sum<<endl;
cout<<"\n the difference of "<<a<<" & "<<b<<" is "<<difference<<endl;
cout<<"\n the product of "<<a<<" & "<<b<<" is "<<product<<endl;
cout<<"\n the quotient of "<<a<<" & "<<b<<" is "<<quotient<<endl;
getch();
}
OUTPUT WILL BE
#include<iostream.h>
#include<conio.h>
void main()
{
int a=10;
int b=3;
int sum, difference, product, quotient;
sum=a+b;
difference=a-b;
product=a*b;
quotient=a/b;
cout<<"the sum of "<<a<<" & "<<b<<" is "<<sum<<endl;
cout<<"\n the difference of "<<a<<" & "<<b<<" is "<<difference<<endl;
cout<<"\n the product of "<<a<<" & "<<b<<" is "<<product<<endl;
cout<<"\n the quotient of "<<a<<" & "<<b<<" is "<<quotient<<endl;
getch();
}
OUTPUT WILL BE
No comments:
Post a Comment