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;
}
Discussion:
36 comments Page 1 of 4.
Anand Kumar S said:
7 years ago
% % will be shown as only %.
= (%%)(%%),
= (%)(%),
= %%.
= (%%)(%%),
= (%)(%),
= %%.
(3)
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.
Because 1st taken as identifier and 2nd as value and just like 3rd taken as identifier and 4th as value.
(2)
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?
What is logic behind it? explain?
(1)
Pavankumar said:
8 years ago
Should we write printf ("\" " ") ;
Printf("""");
What will be display?
Printf("""");
What will be display?
(1)
Amit agarwal said:
9 years ago
Also, we can't print " " using simple printf (" " " ") ;.
Should we write printf ("\" " ") ;?
Should we write printf ("\" " ") ;?
Sneha said:
1 decade ago
Yes I got it.
Dheeraj said:
1 decade ago
Why printf("%??%%%%%\n"); giving output of %??%%% ?
Ranjitha said:
1 decade ago
@josna:
If we print %%% the result is % and not %%.
If we print %%% the result is % and not %%.
Pavani said:
1 decade ago
#include<stdio.h>
#include<conio.h>
main()
{
clrscr();
printf("%\n");//only one % is used
getch();
}
o/p:
%
Q:why it happened?
#include<conio.h>
main()
{
clrscr();
printf("%\n");//only one % is used
getch();
}
o/p:
%
Q:why it happened?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers