How to print percentage symbol '%' on console screen in C programming language? Select your choice... | Sololearn: Learn to code for FREE!
+ 1

How to print percentage symbol '%' on console screen in C programming language? Select your choice...

1. printf("%"); 2. printf("%%"); 3. printf("\%"); 4. None

22nd Feb 2022, 7:24 PM
Muhammad Awais
4 odpowiedzi
+ 4
seems like int main() { int x = 80; printf("%d%%",x); return 0; } would be the solution if that is all you want.
22nd Feb 2022, 9:16 PM
BroFar
BroFar - avatar
+ 2
Have you tried them out?
22nd Feb 2022, 7:38 PM
Slick
Slick - avatar
+ 1
printf("%c",37);
22nd Feb 2022, 9:01 PM
HungryTradie
HungryTradie - avatar
+ 1
In a real programming situation I would say 4. None. Although one of those options would work, you don't need the extra overhead in formatted print just to output a single character. More appropriate would be: putc('%', stdout);
22nd Feb 2022, 9:06 PM
Brian
Brian - avatar