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.

Prajwalita said:   6 years ago
Thanks all for the explanation.

Anand Kumar S said:   7 years ago
% % will be shown as only %.
= (%%)(%%),
= (%)(%),
= %%.
(3)

Reuben said:   7 years ago
Thanks all.
(1)

Kartik Raghav said:   8 years ago
@Niranjan: if we input %% then output ill be single %. If we input %%% then output will same single %.

What is logic behind it? explain?
(1)

Pavankumar said:   8 years ago
Should we write printf ("\" " ") ;
Printf("""");

What will be display?
(1)

Divya said:   8 years ago
@Ganesh.

You are right. In GCC, it is taking like that. Don't know about turbo C. Thank you, friends.

Kamlesh Lohar said:   8 years ago
First % is take as identifier and next take as value that's why output is %%.

Because 1st taken as identifier and 2nd as value and just like 3rd taken as identifier and 4th as value.
(2)

R.Monika said:   9 years ago
I want some more detail explanations! please help me friends.

Amit agarwal said:   9 years ago
Also, we can't print " " using simple printf (" " " ") ;.

Should we write printf ("\" " ") ;?

Sunil said:   10 years ago
C is sea. If you want to find it will in deep.


Post your comments here:

Your comments will be displayed after verification.