## Program To Add Two Numbers In Dev C++

Add two Numbers in C. To add two numbers in C Programming, you have to ask to the user to enter the two number and place the addition of the two number in a variable of same type and print this variable on the screen which is the addition result of the two entered number as shown here in.

- Write a C++ program to add, subtract, multiply and divide two numbers.
- C++ program to perform arithmetic operations.

In this program, we will learn about basic arithmetic operators in C++ programming language.

Arithmetic operators in C++ are used to perform mathematical operations. There are five fundamental arithmetic operators supported by C++ language, which are addition(+), subtraction(-), division(/), multiplication(-), and modulus(%) of two numbers.

Operator | Description | Syntax | Example |
---|---|---|---|

+ | Adds two numbers | a + b | 15 + 5 = 20 |

- | Subtracts two numbers | a - b | 15 - 5 = 10 |

* | Multiplies two numbers | a * b | 15 * 5 = 75 |

/ | Divides numerator by denominator | a / b | 15 / 5 = 3 |

% | Returns remainder after an integer division | a % b | 15 % 5 = 0 |

- In the first program, the user is asked to enter two integer numbers and then program displays the sum of these numbers. In the second C program we are doing the same thing using user defined function. Example 1: Program to add two integer numbers. To read the input numbers we are using scanf function and then we are using printf function.
- In this c program we are going to add two numbers using functions, addition operator and pointers.We will get the values by user and perform the calculation.
- Jul 10, 2019 Program to add two fractions Here we will discuss how to add two fractions using C programming language. To find the sum of two fractions we will be using the concept of LCM and GCD. For example: we have to find the sum of 7/2 and 8/3 Firstly the LCM of 2 and 3 will.

## C++ Program to Perform Addition Subtraction Multiplication Division of Two Numbers

OutputIn above program, we first take two numbers as input from user using cin and store it in variable x and y. Then we perform Addition, Subtraction, Multiplication, Division and Modulus on operands x and y and store the result in variable sum, difference, product, quotient and modulo respectively.

**Recommended Posts**

C++ Program to Find Sum of Natural Numbers |

C++ Program to Count Zeros, Positive and Negative Numbers |

C++ Program to Check Whether a Character is Vowel or Not |

C++ Program to Multiply two Numbers |

C++ Program to Calculate Average Percentage Marks |

C++ Program to Find Quotient and Remainder |

C++ Program to Find Size of Variables using sizeof Operator |

C++ Program to Swap Two Numbers |

C++ Program to Check Whether Number is Even or Odd |

C++ Program to Find Largest of Three Numbers |

C++ Program to Find LCM and GCD of Two Numbers |

All C++ Programs |

The addition of two numbers in C language is performing the arithmetic operation of adding them and printing their sum on the screen. For example, if the input is 5, 6, the output will be 11.

Get your car checked by a mechanic at Precision Tune Auto Care in Eagle Pass, TX 78852, with shop reviews, directions, and repair specialties brought to you by AutoMD. LOG IN Find a Shop. Apr 28, 2017 Precision Tune Auto Care, Eagle Pass, Texas. 29 likes 254 were here. Automotive Repair Shop. Precision Tune Auto Care of Eagle Pass, Texas provides fast and affordable auto repair and maintenance. Let our certified technicians keep your vehicle safe and reliable. See reviews, photos, location, and hours of operation for Precision Tune Auto Care at 2137 E Garrison St, Eagle Pass, TX. Schedule your service today. Get directions, reviews and information for Precision Tune Auto Care in Eagle Pass, TX. Precision Tune Auto Care 2137 E Garrison St Eagle Pass TX 78852. Reviews (830) 758-0701 Website.

## Addition program in C

#include <stdio.h>int main()

{

int x, y, z;

printf('Enter two numbers to addn');

scanf('%d%d',&x,&y);

z = x + y;

printf('Sum of the numbers = %dn', z);

return0;

}

Output of the program:

Download Add numbers program executable.

In the expression (z = x + y), overflow may occur if the sum is greater than the maximum value that the variable z can store.

Similarly, we can write a program that performs subtraction, multiplication, and division of two numbers.

## Addition without using third variable

#include<stdio.h>int main()

{

int a =1, b =2;

/* Storing result of the addition in variable a */

a = a + b;

printf('Sum of a and b = %dn', a);

return0;

}

Doing this isn't recommended because the original value of the variable 'a' is lost; if we require it further in the program, then we will not have it.

## C program to add two numbers repeatedly

#include <stdio.h>int main()

{

int a, b, c;

char ch;

while(1){

printf('Input two integersn');

scanf('%d%d',&a,&b);

getchar();

c = a + b;

printf('(%d) + (%d) = (%d)n', a, b, c);

printf('Do you wish to add more numbers (y/n)n');

scanf('%c',&ch);

Nokia pc suite for mac os x 10.6.8. Feb 13, 2013 Nokia Suite is not available for Mac OS, and it is highly unlikely that it will ever be ported. Apple had an application called iSync that enabled users to synchronise some of their their phone data with the computer, but since OS X Lion, it was dropped from the distribution. This is probably due to the growing emphasis on cloud storage.

if(ch 'y' ch 'Y')

continue;

else

break;

}

return0;

}

### Dev C++ Program Download

Output of program:

26

(2)+(6)=(8)

Do you wish to add more numbers (y/n)

y

Input two integers

2-6

(2)+(-6)=(-4)

Do you wish to add more numbers (y/n)

y

Input two integers

-53

(-5)+(3)=(-2)

Do you wish to add more numbers (y/n)

y

Input two integers

-5-6

(-5)+(-6)=(-11)

Do you wish to add more numbers (y/n)

n

## C program for addition of two numbers using a function

We can calculate sum of two integers using a function.

long addition(long,long);

int main()

{

long first, second, sum;

scanf('%ld%ld',&first,&second);

sum = addition(first, second);

printf('%ldn', sum);

return0;

}

long addition(long a,long b)

{

long result;

result = a + b;

return result;

}

We are using long data type as it can handle large numbers.

### Dev C++ Program To Add Two Numbers

To add numbers that don't fit in in-built data types, use an array, a string, or other suitable data structure.