Give the output on the screen of the following program (indicate a space using this symbol _):
#include<stdio.h>
int main()
{
int a = 7, b = 4, c;
double x = 0.02, y = -0.05, z = 0.1 ;
printf("#1# %d ##\n", (a + b) % 1234);
printf("#2# %d ##\n", a + b + 1 % 1234);
printf("#3# %d ##\n", 4*((a/6)+(4*(b-2))%(a-b)));
a = 7;
printf("#4# %d ##\n", ++a);
a = 7;
printf("#5# %d ##\n", a++);
printf("#6# %9.4lf ##\n", ++x);
printf("#7# %d ##\n", a>b);
x=0.02;
printf("#8# %+9.2lf ##\n", 2 * x + (y == 0));
printf("#9# %+-9.2lf ##\n", 2 * x + y);
printf("#10# %d ##\n", (x>y) && (a<0) || (b>5));
a = 7;
printf("#11# %d ##\n", a%=b);
return 0;
}
Difficulty level
This exercise is mostly suitable for students
#1# 11 ##
#2# 12 ##
#3# 12 ##
#4# 8 ##
#5# 7 ##
#6# _ _ _ 1.0200 ##
#7# 1 ##
#8# _ _ _ _+0.04 ##
#9# -0.01_ _ _ _ ##
#10# 0 ##
#11# 3 ##
Back to the list of exercises
Looking for a more challenging exercise, try this one !!
Encryption of digits