1. Without scanf() Function
#include<stdio.h>
#include<conio.h>
float a,b,c;
clrscr();
a=10.2;
b=5.3;
c=a+b;
printf("Sum of two Numbers=%f" ,c);
getch();
}
Output:
Sum of two Numbers=15.5
2. With the help of scanf() Function:
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf(" Enter the value of a and b:/n");
scanf("%d%d",&a,&b);
c=a+b;
printf("Addition of Two Numbers=%d" , c);
getch();
}
Output:
Enter the value of a and b:
50
40
Addition of Two Numbers=90
0 Response to "C Program: Addition of Two Numbers With or With Out Using scanf() Function"
Post a Comment