Mathematical operations in C++ - Example Program
Write a program to perform the arithmetic operations by using arithmetic operators. Also print the result on the screen.
Program code is given below:
#include<iostream.h>
#include<conio.h>
main(){
int a, b;
clrscr();
a=78;
b=27;
cout<<"-----------------------------------"<<endl;
cout<<"Addition : "<<a+b<<endl;
cout<<"Subtration : "<<a-b<<endl;
cout<<"Multiplcation : "<<a*b<<endl;
cout<<"Division : "<<a/b<<endl;
cout<<"Modulus : "<<a%b<<endl;
cout<<"----------------------------------"<<endl;
}
#include<conio.h>
main(){
int a, b;
clrscr();
a=78;
b=27;
cout<<"-----------------------------------"<<endl;
cout<<"Addition : "<<a+b<<endl;
cout<<"Subtration : "<<a-b<<endl;
cout<<"Multiplcation : "<<a*b<<endl;
cout<<"Division : "<<a/b<<endl;
cout<<"Modulus : "<<a%b<<endl;
cout<<"----------------------------------"<<endl;
}
Thanks for visiting Mathematical operations in C++ - Example Program
Download more from: CS Adventures
Download more from: CS Adventures
0 comments:
Post a Comment