How to add Two numbers in C++ programming
How to add Two numbers in C++ programming
How to download
if you want to download the .CPP file then click on download button
if it does not start click here
Example: 1
#include<iostream>
using namespace std;
int main()
{
int a=21;
int b=41;
cout<<"The sum of two numbers are ="<<a+b<<endl;
}
Example: 2
#include<iostream>
using namespace std;
int main()
{
int a;
int b;
cout<<"Enter 1st Value : ";cin>>a;
cout<<"Enter 2nd Value : ";cin>>b;
int sum;
int multi;
float divi;
int sub;
sum = a+b;
sub = a-b;
multi = a*b;
divi = a/b;
cout<<"sum of a and b is: "<<sum<<endl;
cout<<"subtraction of a and b is: "<<sub<<endl;
cout<<"multiplecation of a and b is: "<<multi<<endl;
cout<<"division of a and b is: "<<divi<<endl;
}
Post a Comment