C program to add two numbers in a single scanf function
C Programming Language Fundamentals of C Language (Article) Fundamentals of C Language (Program)
4875Program:
/** * Write a C program to input two numbers from user and calculate their sum. C program to add two numbers and display their sum as output. How to add two numbers in C programming. */ #include"stdio.h" int main() { int num1, num2, sum; /* * Read two numbers from user */ printf("Enter any two numbers : "); scanf("%d%d", &num1, &num2); sum = num1 + num2; /* Prints the sum of two numbers */ printf("Sum of %d and %d = %d\n", num1, num2, sum); return 0; }
Output:
Enter any two numbers : 66 22 Sum of 66 and 22 = 88 Press any key to continue . . .
This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.