following are some programs to multiply,divide,add,and substract 2 numbers using c++.
- code for addition:-
#include<iostream.h>
void main()
{
int a,b,c;
cout<<"enter the value of a& b";
cin>>a>>b;
c=a+b;
cout<<"addition of a&b is="<<c;
}
- code for substraction:-
#include<iostream.h>
void main ()
{
int a,b,c;
cout<<"enter the value of a&b";
cin>>a>>b;
c=a-b;
cout<<"substraction is ="<<c;
}
- code for multiply:-
#include<iostream.h>
void main()
{
int a,b,c;
cout<<"enter value of a&b";
cin>>a>>b;
c=a*b;
cout<<"mul is ="<<c;
}
- code for division:-
#include<iostream.h>
void main()
{
int a,b,c;
cout<<"enter value of a&b";
cin>>a>>b;
c=a/b;
cout<<"the div is ="<<c;
}
note:- if prog are not running on your compiler add conio.h file and make some changes if you are using turbo c++. and add using namespace std if ur using ubuntu and remove .h .
attach your output comment if any problem withs this stay tunned for learn c++ and comment your email id forcompetative coading. thankyou for visiting our page. see other blogs for more info about the c++.👍😎🙏
0 Comments