C Language Program to Calculate the sum of two numbers.

C - SIMPLE  PROGRAMS


1: Program to Calculate the sum of two given numbers i.e.  x = 8 and y = 10 .Also print the result.

#include<stdio.h>
#include<conio.h>
main( )
{
int  x,y,sum;
x=8;
y=10;
sum=x+y;
printf("sum = %d",sum);
getch( );
}



-------------------------------------------------------------------------------------------------------------------------------



2:  Program to Calculate the sum of any two numbers .Also print the result .
OR
Write a Program which takes two numbers as input from the user and calculates their sum.

#include<stdio.h>
#include<conio.h>
main( )
{
int x,y,sum;
printf("Enter two numbers = ");
scanf("%d,%d",&x,&y);
sum=x+y;
printf("sum = %d",sum);
getch( );
}







Post a Comment

0 Comments