
116 Programming in C
Explanation:
In the above program, age is entered through the keyboard. If the age is greater than 17 years,
a message will be displayed as shown at the output.
5.3 Write a program using curly braces in the if block. Enter only the three numbers and calcu-
late their sum and multiplication.
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);
}
}
OUTPUT:
Enter Three Numbers: 1 2 4
Addition : 7
Multiplication : 8
After second time execution
Enter Three Numbers: 5 v 8
Explanation: ...