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 (%).
- #include<iostream>
- using namespace std;
- int main()
- {
- int x,y;
- cin>>x>>y;
- cout<<"Addition:"<<x+y<<endl;
- cout<<"Subtraction:"<<x-y<<endl;
- cout<<"Multiplication:"<<x*y<<endl;
- cout<<"Integer division:"<<x/y<<endl;
- cout<<"Real division:"<<(float)x/y<<endl;
- cout<<"Modulus"<<x%y;
- }
Learn More :
Integer
- Sort Three Numbers - program reads in three Integers and displays them in ascending order.
- C program to Given a vector (integer or real), determine what is the maximum value of element what is the position in which this element is located
- C Program Generates 10 Random Integers Between 0 and 99.
- Lower-Upper Case/Positive-Negative Integer
- Give me an integer and I will sum it with the previous natural numbers
- Find the union and intersection of two sets of integer store it in two array C Program
- C Program to Detect int Underflow-Overflow using if-else
- Menu Driven Program to Read Two Integers Find Sum, Difference and Product C Program
Modulus
Multiplication
Subtract
Whole Numbers
Real
Mathematical