AUTHOR

header ads
header ads

C PROGRAM FOR THE SUM OF TWO NUMBERS

C PROGRAM FOR THE SUM OF TWO NUMBERS 






In c language the addition of two number is adding the two number by giving input to the complier and getting output as result 

For Example If You Give Input 10 & 5 Then You Get Output As 15 
The Below C Program Is The Simple Addition Of Two Numbers 





/* C PROGRAM FOR ADDITION OF TWO NUMBERS */

#include<stdio.h>
void main()
{
int num1,num2,sum;
printf ("ENTER TWO NUMBER FOR ADDITION /n");
scanf ("%d%d",&num1,&num2);

sum=num1+num2;

printf("ADDITION OF TWO NUMBERS = %d ",sum);

}




Here , #include<stdio.h> contains all c library function like printf & scanf to perform operation in the complier

int is the integer value where we can give natural numbers for input

num1,num2,sum; these are the variable given to the integer type

sum=num1+num2; here the addition of num1 & num2 will be stored in the sum


printf ("") is used to print the result on the screen

scanf("") is used to read the integer , floating point ,etc values from the user

%d is for reading integer values

& is used to store the given values to the variable

\n it used to go to the next line in the c problem




Thank You Visit Again :-)

Post a Comment

0 Comments