C Programming - Input / Output - Discussion

Discussion Forum : Input / Output - Find Output of Program (Q.No. 10)
10.
What will be the output of the program ?
#include<stdio.h>

int main()
{
    printf("%%%%\n");
    return 0;
}
%%%%%
%%
No output
Error
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
36 comments Page 1 of 4.

KRISHNAKANTH YENUMULA said:   2 decades ago
Why four % are not printed?

Niranjan said:   2 decades ago
Because we can't print % in C.

To print % we need %% in C for printing single %.

Hence to print %% we need %%%%.

Salesh said:   2 decades ago
As similarly if you want to print \n in C the syntax is

printf("\\n");

Same concept is here also.

Sharath said:   1 decade ago
Yes the answer given by Niranjan is correct.

Mangai said:   1 decade ago
Ya I accept Niranjan's answer.

Thank you Niranjan for giving the detailed ans.

Premnath said:   1 decade ago
Ya the answer given by Niranjan is correct and also the ans given by the Salesh is also correct.

Thanks to both of them.

Praveen said:   1 decade ago
Salesh has given good logic.

Thank you Salesh.

Prateek said:   1 decade ago
There is no logic behind above answers.

Why happend it?

Madhu said:   1 decade ago
Is it right?

Chandrakumar said:   1 decade ago
Ya. Thank you niranjan I'm cleared from your explanation and I also for salesh for given a logic behind this.


Post your comments here:

Your comments will be displayed after verification.