How to Write a C program to perform basic math operations on two input whole numbers. The basic operations are addition, subtraction, multiplication, integer division, real division, and modulus.

Write a C program to perform basic math operations on two input whole numbers. The basic operations are addition, subtraction, multiplication, integer division, real division, and modulus (%)



  1. //Write a C program to perform basic math operations on two input whole numbers. The basic operations are addition, subtraction, multiplication, integer division, real division, and modulus (%).
  2. #include<iostream>
  3. using namespace std;
  4. int main()
  5. {
  6.     int x,y;
  7.     cin>>x>>y;
  8.     cout<<"Addition:"<<x+y<<endl;
  9.     cout<<"Subtraction:"<<x-y<<endl;
  10.     cout<<"Multiplication:"<<x*y<<endl;
  11.     cout<<"Integer division:"<<x/y<<endl;
  12.     cout<<"Real division:"<<(float)x/y<<endl;
  13.     cout<<"Modulus"<<x%y;
  14. }


Learn More :