0 evaluări0% au considerat acest document util (0 voturi)
3 vizualizări1 pagină
This C program asks the user to input two numbers, adds them together, and displays the sum. It includes the necessary header files, declares three integer variables to hold the two numbers and sum, uses scanf to input the numbers, adds them and stores the result in a third variable, and prints the sum using printf.
This C program asks the user to input two numbers, adds them together, and displays the sum. It includes the necessary header files, declares three integer variables to hold the two numbers and sum, uses scanf to input the numbers, adds them and stores the result in a third variable, and prints the sum using printf.
This C program asks the user to input two numbers, adds them together, and displays the sum. It includes the necessary header files, declares three integer variables to hold the two numbers and sum, uses scanf to input the numbers, adds them and stores the result in a third variable, and prints the sum using printf.
#include<stdio.h> #include<conio.h> void main() { int a,b,c; clrscr(); printf("Enter the value of 1st number"); scanf("%d",&a); printf("Enter the value of 2nd number"); scanf("%d",&b); c=a+b; printf("The sum of two numbers is %d",c); getch(); }