top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

The % symbol has a special use in printf statement. How would this character as part of the output on the screen?

+3 votes
667 views
The % symbol has a special use in printf statement. How would this character as part of the output on the screen?
posted Apr 1, 2016 by Mohammed Hussain

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+1 vote
 
Best answer

We can print "%" in C by writing %% as
printf("%%");

The other way to print "%" is
printf("%c",'%');
or
printf("%s", "%");

answer Apr 4, 2016 by Ashutosh Kumar Anand
0 votes

You can do this by using %% in the printf statement. For example, you can write printf(“10%%”) to have the output appear as 10% on the screen.

answer Apr 1, 2016 by Manikandan J
...