C Program To Add Two Numbers. If you are looking for the addition of two numbers program in C, here in this tutorial we will help you to learn how to write a c program to add two numbers.
C Program To Add Two Numbers
Just copy paste the below source code to add two numbers in C compiler to test, how the source code works. Debug and learn how it works. Happy coding.
C Program To Add Two Numbers Source Code
/* C Program To Add Two Numbers - AddTwoNumbers.C */ #include<stdio.h> int main() { int a, b, sum; //variable declaration printf("Enter two numbers to add: \n"); //asking user to enter numbers scanf("%d%d",&a,&b); //reading user entered numbers sum = a + b; //simple logic to add two numbers printf("Sum of entered numbers = %d\n",sum); //printing sum return 0; }
C Program To Add Two Numbers Output
When you compile and run the above c program to add two numbers, your C compiler asks you to enter the two positive integers to add. After entering the numbers, C compiler will perform addition and display sum of the two numbers.
Output:
Enter two numbers to add: 10 20
Sum of entered numbers = 30
C PROGRAMMING EXAMPLES
- C Program To Reverse A Number
- C Program to Find Maximum and Minimum Numbers
- C Program to Read a Text File
- C Program to Convert Decimal to Hexadecimal
- C Program to Convert Decimal to Binary
- C Program to Convert Celsius to Fahrenheit
- C Program To Find Absolute Value
- Ternary Operator Program in C
- C Program For Addition Table Using For Loop
- Denomination Program in C
- C Program to Print Multiplication Table
- C Program Array with Example
- Binary Search in C Program Using Recursion
- Bubble Sort in C Using Pointers
- Bubble Sort Program in C Using Recursion
- Bubble Sort Program in C Using Array
- Bubble Sort Program in C Using Function
- Bubble Sort Program in C Using Linked List
- Stack Push Pop Program in C Using Arrays
- Factorial Program in C Using Pointers