C Program to Add two numbers

Here is a C program to add two numbers using procedural approach, and using simplest way available.

C Program to Add two integer numbers

Source Code:

// simple c program to add two numbers 
#include <stdio.h>

int main() {
//defining variable as a integer 
int num1, num2, sum;

//assigning values to the variables
num1 = 10;
num2 = 20;

//calulating sum of two numbers and result assigne to sum 
sum = num1 + num2;

//now print the value of the sum in output device
printf("Sum of two number is: %d",sum);

return 0;
}

Output:

Sum of two number is: 30

Recommended Post

Posted in: C