Programming Examples
Write a program enter only the three numbers and calculate their sum and multiplication
Write a program enter only the three numbers and calculate their sum and multiplication?
Solution
#include<stdio.h>
void main()
{
int a,b,c,x;
clrscr();
printf(“\nEnter Three Numbers:”);
x=scanf(“%d %d %d”,&a,&b,&c);
if(x==3)
{
printf(“\n Addition : %d”,a+b+c);
printf(“\n Multiplication : %d”, a*b*c);
}
getch();
}
Output
Enter Three Numbers: 1 2 4
Addition : 7
Multiplication : 8
After second time execution
Enter Three Numbers: 5 v 8