Sum Two Numbers in C: Simple Guide
In C language, you can store these two numbers by defining two variables and then using the addition operator “+” to find their sum. For example:
#include <stdio.h>
int main() {
int num1 = 5;
int num2 = 10;
int sum = num1 + num2;
printf("Sum of %d and %d is %d\n", num1, num2, sum);
return 0;
}
In the example above, we defined two variables, num1 and num2, to store the values 5 and 10 respectively. We added them using the + operator and stored the result in the variable sum, which was then printed using the printf function. The final output is “Sum of 5 and 10 is 15”.