当前位置:网站首页>How to output the percent sign "%" in printf function in C language

How to output the percent sign "%" in printf function in C language

2022-06-11 07:43:00 Zhangxueheng

Listen to today c A whim occurred during the language online class , How to record the efficiency of reading ? for example , I have a good book , All in all 200 page , I read it today 20 page , So I read 10 percent , That is to say %10, But how does this work c What about the language ? So here's the code :

I am a c Language novice , I feel like I can write one under the premise of the code I want to write c Language program , It's a big improvement for me .% The use of No. 1 made me begin to explore :

Is a direct input % Number

 

 

 

Still output like this /%

 

Or it can be output like this \% 

  Finally, I learned that , You need to write it like this to get the percentage sign I want to output %

  Here is just a basic input and output , test %%%d Whether the output can be successful % Number .

The conclusion is that if you want to output a percent sign %    Before the data you want to express ( namely %d perhaps %f perhaps %lf) Add two percent signs .

Wrote this , I suddenly have another question , What would happen if the three percent signs were separated ?

I'll try , Explain the conclusion by procedure !

 

 

 

I'm using the two symbols for percent % A space is added between the numbers , A space is added before and after the two percent signs that represent the percent sign , The results show that , The two percent signs still represent % Output No , The interval can only be separated from the number to be output later , And there is also a distance from the previous characters .

study hard , Day day up . This is a conclusion ! Instead of a simple sentence , Let's work together ! Common progress !

原网站

版权声明
本文为[Zhangxueheng]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/03/202203020519312329.html