C program to print the addition of two numbers. The user is requested to enter two integers in this example. The sum of these two integers is then computed and shown on the screen. You should be familiar with the following C programming subjects, such as basic c programs, in order to comprehend this example.
int a, b, sum;
printf("Enter two integers");
scanf("%d %d", &a, &b);
sum = a + b;
printf("%d + %d = %d", a, b, sum);
Enter two integers45
45 + 45 = 90
How to print the addition of two numbers in c
In this application, Printf() displays the text Hello World on the screen. The user is requested to enter two integers in this software. Variables a and b are used to store these two integers. Then, using the + operator, these two values are added, and the result is saved in the sum variable.