C programming examples with output Part – 2
Program

1) What is the output of the following program? if the user inputs the values as 9876545623
void main()
{
int a,b,c:
scanf ("%1d %2d %d", &a, &b, &c);
printf ("sum=%d", a+b+c);
}
Output:
987654 564 23
sum=750
2) What is the output of the following program?
# include<stdio.h>
void main()
{
int i=15, j=4, m, n;
m= i>9;
n= j>4 && j!=2;
printf("m=%d n=%d", m, n);
}
Output:
m = 1 n = 0
3) What is the output of the following program?
#include <stdio.h>
void main()
{
int x=5, m, k=1, n;
float y=2.5;
m=x*1000 + y*10;
k=m/1000 +x;
n=(x==y) ?k:m;
printf("%d /n%d", m, k, n);
}
Output:
5025
10
5025
4) What is the output of the following program? – Cube Equation
#define CUBE(X) (X*X*c)
void main()
{
printf ("%d", CUBS);
}
Output:
4