# C Program to Add two Integers

Given two numbers A and B. The task is to write a program to find the addition of these two numbers.

**Examples**:

Input: A = 2, B = 3Output: 5Input: A = 3, B = 6Output: 9

In the below program to add two numbers, the user is first asked to enter two numbers and the input is scanned using the scanf() function and stored in the variables and . Then, the variables and are added using the arithmetic operator and the result is stored in the variable **sum**.

Below is the C program to add two numbers:

`// C program to add two numbers ` `#include<stdio.h> ` ` ` `int` `main() ` `{ ` ` ` `int` `A, B, sum = 0; ` ` ` ` ` `// Ask user to enter the two numbers ` ` ` `printf` `(` `"Enter two numbers A and B : \n"` `); ` ` ` ` ` `// Read two numbers from the user || A = 2, B = 3 ` ` ` `scanf` `(` `"%d%d"` `, &A, &B); ` ` ` ` ` `// Calclulate the addition of A and B ` ` ` `// using '+' operator ` ` ` `sum = A + B; ` ` ` ` ` `// Print the sum ` ` ` `printf` `(` `"Sum of A and B is: %d"` `, sum); ` ` ` ` ` `return` `0; ` `} ` |

*chevron_right*

*filter_none*

**Output**:

Enter two numbers A and B : 2 3 Sum of A and B is: 5

## Recommended Posts:

- Recursive program to print formula for GCD of n integers
- Program to print N minimum elements from list of integers
- Find N distinct integers with zero sum
- Even-odd turn game with two integers
- Find N distinct integers with sum N
- Longest Subarray of non-negative Integers
- Sum of integers upto N with given unit digit
- Find if it is possible to choose subarray that it contains exactly K even integers
- Find the first N integers such that the sum of their digits is equal to 10
- Check if a number can be written as sum of three consecutive integers
- Check if N can be represented as sum of squares of two consecutive integers
- Count of digits after concatenation of first N positive integers
- Find Prime Adam integers in the given range [L, R]
- C Program for Program to find area of a circle
- C Program for Program for array rotation
- Lex Program to remove comments from C program
- Program to wish Women's Day
- Program for EMI Calculator
- Program for sum of cos(x) series
- Program to find sum of 1 + x/2! + x^2/3! +...+x^n/(n+1)!

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.