Tuesday, 24 February 2015

C++ Program for Addition, Subtraction, Multiplication, Division and Modulus(Reminder) of Two Numbers

I am not telling about the history of C/C++ language.Programming Is nothing But Just a line of Code in Computer Language, as we Speak Multi language's same our system has its own Language like C, C++, and Java.You have to know that our Computer Know's Only '0' (Zero) And '1' (One), one more thing I want to share with you in programming HELLO WORLD! is a very famous program but I am not going to start with Hello World. For compiling your code we need a compiler there are many compilers like Borland, Dev-C++, Turbo C, Code Blocks you can use anyone of them My favorite is Dev C++ cause it is fast and simple in use.But I think Codeblocks Is Better.I recommend Dev-C++ for beginner's And for Expert CodeBlocks 
For Downloading DEV-C++ Click Here
Your First Step To Analysis The Following Code and Write And Modify By Own. Below are some basic program in C++ for understanding a syntax of C++

1. C++ Program To Add Two Number

#include<iostream>                        //header file for input output
using namespace std;                      // for initilize input output statement
int main()                                        //starting a program
{
long a,b,c;                                       // long is a data type you can use float,double,and int
cout<<"enter the two nuber :"<<endl;
cin>>a>>b;                                    //enter value a nad then b
c=a+b;                                           //store sum in c
cout<<"sum is = "<<c<<endl;      //print sum
return 0;
}

2. C++ Program To Subtract Two Number

#include<iostream>                        //header file for input output
using namespace std;                      // for initilize input output statement
int main()                                        //starting a program
{
long a,b,c;                                       // long is a data type you can use float,double,and int
cout<<"enter the two nuber :"<<endl;
cin>>a>>b;                                    //enter value a nad then b
c=a-b;                                           //store sum in c
cout<<"subtraction is = "<<c<<endl;      //print sum
return 0;
}

3. C++ Program To Multiply Two Number

#include<iostream>                        //header file for input output
using namespace std;                      // for initilize input output statement
int main()                                        //starting a program
{
long a,b,c;                                       // long is a data type you can use float,double,and int
cout<<"enter the two nuber :"<<endl;
cin>>a>>b;                                    //enter value a nad then b
c=a*b;                                           //store sum in c
cout<<"multiple is = "<<c<<endl;      //print sum
return 0;
}

4. C++ Program To Divide Two Number

#include<iostream>                        //header file for input output
using namespace std;                      // for initilize input output statement
int main()                                        //starting a program
{
long a,b,c;                                       // long is a data type you can use float,double,and int
cout<<"enter the two nuber :"<<endl;
cin>>a>>b;                                    //enter value a nad then b
c=a/b;                                           //store sum in c
cout<<"devision is = "<<c<<endl;      //print sum
return 0;
}

5. C++ Program To Find Modulus (Reminder) Of Two Number

#include<iostream>                        //header file for input output
using namespace std;                      // for initilize input output statement
int main()                                        //starting a program
{
long a,b,c;                                       // long is a data type you can use float,double,and int
cout<<"enter the two nuber :"<<endl;
cin>>a>>b;                                    //enter value a nad then b
c=a%b;                                           //store sum in c
cout<<"modulus is = "<<c<<endl;      //print sum
return 0;
}

6. C++ Program To Find Average Of Two Number

#include<iostream>                        //header file for input output
using namespace std;                      // for initilize input output statement
int main()                                        //starting a program
{
long a,b,c;                                       // long is a data type you can use float,double,and int
cout<<"enter the two nuber :"<<endl;
cin>>a>>b;                                    //enter value a nad then b
c=(a+b)/2;                                           //store sum in c
cout<<"avg is = "<<c<<endl;      //print sum
return 0;
}



Introduction Of Programming With C And C++

Ghanendra Yadav
Ghanendra Yadav

I Am Ghanendra Yadav Owner Of This Website. I Love Programming, Web Developing, Logo Making, Banner And Website designing. Currently I Am Studying In NIT Warangal And Also Working With WSDC( As Web Application Developer ) In NIT Warangal For Any Query Mail Me I Will Answer Within 24 Hours Email:- yghanendra@student.nitw.ac.in

Find me on Social Media

Facebook | Twitter | Google+ | RSS Feed

No comments:

Post a Comment