Write a program to print sum of 2 numbers in c
Program to print sum of 2 numbers
Let's see a simple example of input and output in C language
that prints addition of 2 numbers.
#include<stdio.h>
int main(){
int x=0,y=0,result=0;
printf("enter first number:");
scanf("%d",&x);
printf("enter second number:");
scanf("%d",&y);
result=x+y;
printf("sum of 2 numbers:%d ",result);
return 0;
}
Output
enter first number:9enter second number:9sum of 2 number:18
Comments
Post a Comment