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 3 of 4.
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?
Narayan said:
1 decade ago
I don't get anyone answer. Can anyone please explain about :
1. printf("%%%\n") (what will be o/p).
2. printf("%%\n") (what will be o/p).
3. printf("%\n") (what will be o/p).
Give ans respectively with proper explanation.
1. printf("%%%\n") (what will be o/p).
2. printf("%%\n") (what will be o/p).
3. printf("%\n") (what will be o/p).
Give ans respectively with proper explanation.
Bhavesh jain said:
1 decade ago
printf("%\n")
It will give output % . and to print % in c we have to add \n or \t or \r ..so it will terminate the % which starts finding for the d,s,c,f char to print something. so if we give \t ,\n then it will stop finding and simply print %.
It will give output % . and to print % in c we have to add \n or \t or \r ..so it will terminate the % which starts finding for the d,s,c,f char to print something. so if we give \t ,\n then it will stop finding and simply print %.
K Jagannadham said:
1 decade ago
We can print % in C.
But another way to print % we need %% in C.
But to print %% we need %%% or %%%% in C.
And next to print %%% we need %%%%% or %%%%%% in C.
And so on.....
But another way to print % we need %% in C.
But to print %% we need %%% or %%%% in C.
And next to print %%% we need %%%%% or %%%%%% in C.
And so on.....
Sunil said:
10 years ago
C is sea. If you want to find it will in deep.
Amit agarwal said:
9 years ago
Also, we can't print " " using simple printf (" " " ") ;.
Should we write printf ("\" " ") ;?
Should we write printf ("\" " ") ;?
R.Monika said:
9 years ago
I want some more detail explanations! please help me 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.
Because 1st taken as identifier and 2nd as value and just like 3rd taken as identifier and 4th as value.
(2)
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers