What will be the output of the following code?

What will be the output of the following code? mcq and its answer is provided on this page.

What will be the output of the following code?

Que. What will be the output of the following code?
a char t=’N’;
b printf(“\n %c \n %3c \n %5c”,t,t,t);
c a)              N
d N
e N
f b)    N
g N
h N
i c)  N
j N
k N
l d)   N  N  N
Answer: b
Explanation : In the given code each argument is printed on a new line due to control character \n. Width mentioned in the above code is 1,3,5 hence the character is printed on a new line after being padded with blank spaces.


Comments