Home / Programs / Program to find sum of two numbers
Programming Example

Program to find sum of two numbers

👁 1,232 Views
💻 Practical Program
📘 Step by Step Learning
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><br />#include<conio.h><br />void main()<br />{<br /> int a,b,s; <br /> printf("Enter two no: ");<br /> scanf("%d%d",&amp;a,&amp;b);<br /> s=a+b;<br /> printf("sum=%d \n",s); <br />}

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

How to learn from this program

First read the algorithm, then study the program code line by line. After that, compare the code with the output and finally go through the explanation. This approach helps learners understand both the logic and the implementation properly.