In the c++ programming arithmetic operations is suppose to the simple and basic programs in which you can perform the addition multiplication,subtraction,reminder and division.
this is like the ABC of C++ language. here you will see the basic operations you will understand.
you will download the microsoft visuall c++ and try to perform these basic operations
WRITE A PROGRAMME THAT COMPUTES THE SUM OF TWO INTEGERS.
In the addition you will first give the library or header file then add main function which control your programs and after giving values to variable you write the logical code or perform the operation which you wanna perform.
CODE for C++
#include<iostream.h>
void main()
{
int x,y,sum;
cout<<"enter first number"<<endl;
cin>>x;
cout<<"enter second number"<<endl;
cin>>y;
sum=x+y;
cout<<"result is ="<<sum;
}
OUTPUT
WRITE A PROGRAMME THAT COMPUTE THE SUBTRACTION OF TWO NUMBERS
CODE for C++
#include<iostream.h>void main()
{
int num1,num2,sum;
cout<<"enter first number\n";
cin>>num1;
cout<<"enter second number\n";
cin>>num2;
sum=num1-num2;
cout<<" SUBTRACTION RESULT IS "<<sum<<endl;
}
OUTPUT
WRITE A PROGRAMME THAT COMPUTES MULTIPLICATION
In the subtraction you just change the operational sign and have perform the function of multiplication. you will se the code
CODE for C++
#include<iostream.h>
void main()
{
int num1,num2;
float answer;
cout<<"enter first number\n";
cin>>num1;
cout<<"enter second number\n";
cin>>num2;
answer=num1*num2;
cout<<" answer is "<<answer<<endl;
}
OUTPUT
WRITE A PROGRMME THAT COMPUTES DIVISION OF TWO INTEGERS
In the subtraction you just change the operational sign and have perform the function of multiplication. you will se the code
CODE for C++
#include<iostream.h>
void main()
{
int num1,num2;
float answer;
cout<<"enter first number\n";
cin>>num1;
cout<<"enter second number\n";
cin>>num2;
answer=num1/num2;
cout<<" answer is "<<answer<<endl;
}
OUTPUT
WRITE A PROGRAMME THAT COMPUTES REMINDER
In the subtraction you just change the operational sign and have perform the function to compute reminder. you will se the code
CODE for C++
#include<iostream.h>
void main()
{
int num1,num2;
float answer;
cout<<"enter first number\n";
cin>>num1;
cout<<"enter second number\n";
cin>>num2;
answer=num1%num2;
cout<<" reminder is "<<answer<<endl;
}
OUTPUT
if you have any confusion regarding this article please comment on it i will try to reply as soon as possible. thank you for reading my article.
BYE
0 comments:
Post a Comment