# C Program for Addition of Two Numbers

We will make this program in various ways. These are as follows:

• C Program for Addition of Two Numbers (Simple Way)
• C Program for Addition of Two Numbers Using Function
• C Program tfor Addition of Two Numbers Using Array

Now let’s actually start to program.

## C Program for Addition of Two Numbers (Simple Way)

To get the Addition of two numbers, we have to first take two numbers from the user, then calculate these numbers to find the sum.

formula to calculate the Addition of two numbers

Sum = a+b;

### Algorithm

• Program Start
• Declaring Variables (x,y,sum)
• Input Two Numbers
• Calculating Sum of Two Numbers
• Displaying the Sum of Two Numbers
• Program End

### Program

``````//C Program for Addition of Two Numbers (Simple Way)

#include<stdio.h>
void main()
{
//Declaring three Variables
int x, y, sum;

//Input  Numbers
printf("Enter Two Numbers : \n");
scanf("%d %d",&x, &y);

//Calculating Sum of Two numbers
sum = x + y ;

//Desplaying Sum
printf("Sum is : %d", sum);

}``````

## Output

``````Enter Two Numbers :
2
9

Sum is : 11``````

## C Program to Find the Sum of Two Numbers Using Function

To find the sum of two numbers through a function, first you need to know about the function. You can read about the function from the link given below.

### Algorithm

• Program Start
• Declaring variables
• Input two Number
• Calling Function to calculate Sum of Two Numbers
• Print the Sum of two Numbers
• Program End

### Program

``````//C Program to Find the Sum of Two Numbers Using Function

#include<stdio.h>
int sum(int, int);
int main()
{
//Declaring Variables
int x, y, s;

//Input two Numbers From User
printf("Enter Two Numbers : \n");
scanf("%d %d",&x, &y);

//Calling Function to find the Sum of two numbers
s = sum(x,y);

printf("Sum is : %d \n", s);

return 0;
}
int sum(int a, int b)
{
return (a+b);
}``````

### Output

``````Enter Two Numbers :
32
81

Sum is : 113``````

## C Program to Find the Sum of Two Numbers Using Array

To find the sum of two numbers through an Array, first you need to know about the Array. You can read about the Array from the link given below.

• Array in C

### Algorithm

• Program Start
• Declaring variables (sum , a)
• Input two Numbers From the User
• Calculating Sum
• Display the Sum of two Numbers
• Program End

### Program

``````//C Program to Find the Sum of Two Numbers Using Array

#include<stdio.h>
int main()
{
//Declaring  Variables

int i, sum = 0, a;

//Input Numbers
printf("Enter Two Numbers : \n");
for(i=0; i<2; i++)
{
scanf("%d",&a[i]);
}

//Calculating Sum
for(i=0; i<2;i++)
{
sum = sum + a[i];
}
printf("Sum is : %d", sum);

return 0;
}``````

### Output

``````Enter Two Numbers :
23
75

Sum is : 98``````

## Conclusion

So friends, in this article, we have made a program to calculate the sum of two numbers in three different ways.

• C Program to Find the Sum of Two Numbers (Simple Way)
• C Program to Find the Sum of Two Numbers Using Function
• C Program to Find the Sum of Two Numbers Using Array

If you have difficulty to understand any program or have any doubts or questions, then tell me in the comment below. Jeetu Sahu is A Web Developer | Computer Engineer | Passionate about Coding, Competitive Programming, and Blogging 