繁体   English   中英

在 C 中将 int 转换为空格

[英]converting an int to blank spaces in C

我正在尝试将用户输入的整数转换为空格。 例如,当 int = 3 时,将有 3 个空格作为输出。 我需要将数字 0-15 转换为 0-15 个空格。 我是编程新手,因此非常感谢任何帮助!

你必须阅读printf()函数

int x;
if (scanf("%d", &x) == 1)
    printf("%*s/ <--- there are %d white spaces behind\n", x, "", x);
else
    printf("wrong input, an integer expected\n");

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM