Skip to main content

How To Add Two Numbers In C

 Add Two Numbers In C


#include <stdio.h>//header file
#include<conio.h>//header file
void main()//starting main
{
clrscr();//for clearing the screen
int a,b,sum=0;//declaring variable
printf("enter the value of a");//input the values
scanf("%d",&a);
printf("enter the value of b");//input the values
scanf("%d",&b);
sum=a+b;//adding the numbers
printf("the sum is %d",sum);//printing the sum
getch();
}

     


Comments

Popular posts from this blog

C++ Program Finding The Absolute Value

#include<iostream> using namespace std; int main() { cout<<" enter any number"; cin>>num; if(num>0) { cout<<"The absolute value of number is:"<< num; } else { cout<<"The absolute value of number is :"<< -(num); } return 0; } OUTPUT Enter Any number: 2 The absolute value of number is 2