C++ Program to perform addition subtraction multiplication division
Simple C++ to calculate sum, subtraction, multiplication division: To perform all of these we use operator +,-,/,*. To print division of two numbers, we use type casting. Typecasting from int to float using (float)number.
#include<iostream> using namespace std; int main() { int m,n,multi,sum,subt; float division; cout<<"Enter two numbers: "<<endl; cout<<"Enter first number: "; cin>>m; cout<<"Enter second number: "; cin>>n; sum=m+n; subt=m-n; multi=m*n; division=(float)m/n; cout<<"Sum of two number = "<<sum<<endl; cout<<"Subtraction "<<subt<<endl; cout<<"Multiplication = "<<multi<<endl; cout<<"Division = "<<division; return 0; }