如何在 C 中打印百分号(%)? [英] How do I print the percent sign(%) in C?

查看:86
本文介绍了如何在 C 中打印百分号(%)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 C 的初学者.为什么这个程序会打印 % 符号?

I am a beginner in C. Why does this program does print the % sign?

代码是:

#include <stdio.h>

main()
{
     printf("%");
     getch();
}

推荐答案

你的问题是你必须改变:

Your problem is that you have to change:

printf("%"); 

printf("%%");

或者您可以使用 ASCII 代码并编写:

Or you could use ASCII code and write:

printf("%c", 37);

:)

这篇关于如何在 C 中打印百分号(%)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆