Professional Documents
Culture Documents
C Programming Code: #Include
C Programming Code: #Include
C Programming Code: #Include
addition on two numbers and then prints the sum on the screen. For example if the user entered two
numbers as 5, 6 then 11 (5 + 6) will be printed on the screen.
C programming code
#include<stdio.h>
int main()
{
int a, b, c;
c = a + b;
return 0;
}
Output of program:
In the expression (c = a + b) overflow may occur if sum of a and b is larger than maximum value
which can be stored in variable c.
main()
{
int a = 1, b = 2;
return 0;
}
int main()
{
int a, b, c;
char ch;
while (1) {
printf("Inut two integers\n");
scanf("%d%d", &a, &b);
getchar();
c = a + b;
return 0;
}
Output of program:
main()
{
long first, second, sum;
printf("%ld\n", sum);
return 0;
}
result = a + b;
return result;
}
We have used long data type as it can handle large numbers, if you want to add still larger numbers
which doesn't fit in long range then use array, string or other data structure.