VOOZH about

URL: https://www.geeksforgeeks.org/c/how-to-print-using-printf/

⇱ How to print % using printf()? - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

How to print % using printf()?

Last Updated : 4 Apr, 2025

Here is the standard prototype of printf function in C:

int printf(const char *format, ...);

The format string is composed of zero or more directives: ordinary characters (not %), which are copied unchanged to the output stream; and conversion specifications, each of argument (and it is an error if insufficiently many arguments are given). 

The character % is followed by one of the following characters. 

  • Flag character 
  • Field width
  • Precision
  • Length modifier
  • Conversion specifier

The main thing to note in the standard is the below line about conversion specifier.

A '%' is written. No argument is converted. The complete conversion specification is'%%'.

So, we can print "%" using "%%" 


Output
%

We can also print "%" using below. 

printf("%c", '%');
printf("%s", "%");

Comment