Sum of 2 integer numbers in c language.//
How to print sum of 2 numbers in c language.
 |
Sum of two integer number |
Sum of 2 integer number:
For a sum of 2 integer numbers, we have to take 3 integer variables.
2 for value which we have to add.
example:
Int a,b;
These 2 variable gets value from the user which we have to get addition.
Let's take a=3 and b=2.
1 for an answer where we get the sum of 2 numbers.
This variable takes for an answer. This variable gives us the sum of 2 numbers.
For example:
Int sum;
Sum=a+b;
So sum variable has a value that is an addition of 2 and 3.
And we get answer sum=5.
Example::
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,add;
clrscr();
printf("\nWelcome,CoderFact\n---------------Sum---------------");
printf("\nEnter a First Number :");
scanf("%d",&a);
printf("\nEnter a Second Number :");
scanf("%d",&b);
add=a+b;
printf("\n--------------Answer--------------\nTwo Number Sum is %d",add);
getch();
}
OUTPUT::
Here we want to the addition of 2 numbers of 12 and 13.
And we get an answer in sum variable is =25
Example::
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("\nWelcome,CoderFact\n---------------Sum---------------");
printf("\nEnter a First Number :");
scanf("%d",&a);
printf("\nEnter a Second Number :");
scanf("%d",&b);
printf("\n--------------Answer--------------\nTwo Number Sum is %d",a+b);
getch();
}
OUTPUT::
We hope you understand this topic if you have any queries related to this topic you can write your question and queries in the comment section we will solve them out as soon as possible.
Thank you.
Comments
Post a Comment