In this easy coded program, you will learn how the addition of two numbers takes place using two variables.
Actually, using less variables is preferred the most wherever possible. Rather, the same program can also be solved using three variables.
---------------------------------------------------------------------------
---------------------------------------------------------------------------
Hope you found this 'C Program for Addition of Two Numbers(2 Variables)' easy, simple and helpful!
Try to solve more queries by yourself by referring more examples from BEGINC. Here you will get the most easiest code to each and every query. Keep practicing. More programs are coming.
Actually, using less variables is preferred the most wherever possible. Rather, the same program can also be solved using three variables.
---------------------------------------------------------------------------
Program for Addition of Two Numbers
/*Addition of Two Numbers using Two Variables*/
|
#include<stdio.h>
|
void main()
|
{
|
int
a, b;
|
printf("Enter Two Numbers: ");
|
scanf("%d %d", &a, &b);
|
printf("\nThe Addition of %d and %d is %d.",
a, b, a+b);
|
/*You can exclude
the step below.*/
|
printf("\ni.e. %d+%d=%d", a, b, a+b);
|
}
|
Output
Enter Two Numbers: 5 7
The Addition of 5 and 7 is 12.
i.e. 5+7=12
---------------------------------------------------------------------------
Hope you found this 'C Program for Addition of Two Numbers(2 Variables)' easy, simple and helpful!
Try to solve more queries by yourself by referring more examples from BEGINC. Here you will get the most easiest code to each and every query. Keep practicing. More programs are coming.
Comments
Post a Comment
Please do not comment any spam links in the comment box.