pages

Thursday, 8 April 2021

c-program to calculate the sum of the two number | c-programming langauges

 Program to calculate the sum of the two number in c-programing?

In this program ,we will find how to calculate the sum of the two integers entered by the user and print the sum of the values in c-language.

When user entered the two values, then this two integers are stored in variables a and b respectively. then these two numbers are added using the + operator ,and result is stored in the sum variable.


#include<stdio.h>
#inlcude<conio.h>
main()
{
    int a,b,sum=0;
    printf("Enter two numbers");
    scanf("%d%d",&a,&b);
    sum=a+b;
    printf("sum of %d and %d is %d",a,b,sum);
    getch();
}

output :- 

             enter the two numbers a=4 and b=6
             the sum of the two number are c=10


For more c-programming example:-
.










No comments:

Post a Comment