How to print % using printf()
How to print % in C Programming ?
To print any data on the output screen we use printf() function in C programming language. Using printf() we can print any character, symbol or number, but it seems a bit difficult to print % using printf(). If we simply write “%” in printf(), it will not print % and will show an error. For printing ‘%’, there is a specific format specifier i.e; “%%”, using this in printf() we can print %.
Lets see a example and understand how to print ‘%’ using “%%”
C Code for printing %
Run
#include <stdio.h> int main() { printf(" For printing %% we use %%%%"); return (0); }
Output
For printing % we use %%
Prime Course Trailer
Related Banners
Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription
Get over 200+ course One Subscription
Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others
Login/Signup to comment