Testing.

Tuesday, 27 December 2016

C progarmming language: C program to add two numbers (Mathematics operation).

//Normal program
#include<stdio.h>
#include<conio.h>
void main()
{
int a=10,b=30;
printf("%d",a+b);
getch();
}

output:- 40

//Ask number from user to add

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c=0;
printf("Enter No to add: ");
scanf("%d %d",&a,&b);
c=a+b;
printf("%d + %d= %d",a,b,c);
getch();
}




No comments:

Post a Comment