Home› C Programming Language for Problem Solving› / Programs / Program to find sum of two numbers
🚀 Programming Example

Program to find sum of two numbers

1,253 Views
Beginner
Code Snippet
Addition of two number in c: In this program, we are going to add two numbers which are taken from the user

💻 Program Code

#include <stdio.h>

int main()
{
    int a, b, s;

    printf("Enter two numbers: ");
    scanf("%d%d", &a, &b);

    s = a + b;

    printf("Sum = %d\n", s);

    return 0;
}

🖥 Program Output

                                Enter two no: 5 10
sum=15
Press any key to continue . . .
                            

📘 Explanation

We take two number 5 and 10 output=(5+10)=15
📚 Learning Subject

Master Programming Through Practical Examples

Improve your coding logic, problem-solving skills and programming confidence by practicing real-world examples with explanations.

🎯 How to learn from this example

First understand the algorithm carefully. Then study the program line-by-line and compare it with the output. Finally, review the explanation section to strengthen your logic and programming understanding.

🔥 Practice suggestion

Rewrite the program without looking at the code. Modify values, conditions or logic and run it again. This helps improve confidence and strengthens coding skills much faster.