2/24/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

Hello, I Am Ghanendra Yadav Owner of This Blog, I am professional Blogger and Programmer. I Love Programming, Logo Making, And Banner Designing. My Highest Qualification is MCA From NIT Warangal. You Can Find Me On Social Media Through Below Link And If You Have Any Query Related To Programming And Other Subject Comment Below or You Can Mail Me I Will Try To 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