04/03/2023

C++ Program For Addition, Subtraction, Multiplication, Division, Modulus, And Average

Write a C++ Program For Addition, Subtraction, Multiplication, Division, Modulus, And Average.  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 Knows Only '0' (Zeros) And '1' (Ones). C++ code for addition subtraction multiplication division

For Downloading DEV-C++ Click Here

C++ Program For Addition, Subtraction, Multiplication, Division, Modulus, And Average


Your First Step is To Analysis The Following Code and Write And Modify it By Own. Below are some basic programs in C++ for understanding the syntax of C++

C++ Program For Addition


#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;
}

C++ Program to Subtraction Two Numbers


#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 numbers :" << 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;
}

C++ Program to Multiplication Two Numbers


#include <iostream> //header file for input-output
using namespace std;	// for initialise 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;
}

C++ Program to Division Two Numbers


#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;
}

C++ Program to Modulus Two Numbers


#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;
}

C++ Program to Average Two Numbers


#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;
}


Previous Post
Next Post

post written by:

Hi, I’m Ghanendra Yadav, SEO Expert, Professional Blogger, Programmer, and UI Developer. Get a Solution of More Than 500+ Programming Problems, and Practice All Programs in C, C++, and Java Languages. Get a Competitive Website Solution also Ie. Hackerrank Solutions and Geeksforgeeks Solutions. If You Are Interested to Learn a C Programming Language and You Don't Have Experience in Any Programming, You Should Start with a C Programming Language, Read: List of Format Specifiers in C.
Follow Me

1 comment:

  1. Thanks for providing these programs, is turbo c++ ide good to code in c++ language or to just practice programs for beginners.

    ReplyDelete