C programming provides a straightforward approach to adding two numbers. This involves declaring variables to store the numbers, taking user input for the numbers, and performing the addition operation using the ‘+’ operator. Finally, the result is displayed to the user.
C Program to Add Two Number
The following C code perform addition of two number and displays the result
#include <stdio.h>
void main()
{
int num1, num2, sum;
printf("Enter the first number: ");
scanf("%d", &num1);
printf("Enter the second number: ");
scanf("%d", &num2);
sum = num1 + num2;
printf("%d + %d = %d\n", num1, num2, sum);
}