Write a C program to add Two Integers
Add Two Integers User Input:
#include <stdio.h> int main(){ int mum1, mum2, Sum of integers; printf("Enter first integer: ");//entered by user// scanf("%d", &num1);//entered by user// printf("Enter second integer: "); scanf("%d", &nuum2); Sum of integers = num1 + num2;//using sum adding two integers// printf("Sum of %d and %d is %d", first integer, second integer, Sum of integers); return 0; }
Output:
Enter first integer: 2 Enter second integer: 4 Sum=6
Conclusion:
In conclusion, this simple C program serves as a foundation for understanding basic programming concepts such as variable declaration, user input, arithmetic operations, and output display. It provides a hands-on experience for beginners to grasp the structure and syntax of a C program. As you progress in your programming journey, you’ll encounter more complex tasks and concepts, building upon the foundational knowledge demonstrated in this introductory program.