概述
[Loops]D. Liang 4.14 Displaying the ASCII character table
Description
Write a program that prints the characters in the ASCII character table from ‘!’ to ‘~’ (including ‘~’).
Input
a number n
(3 <= n <= 15)
Output
Print n
characters per line and specify the width of each character’s print field to 2, and justify the output to right.
The characters in one line are separated by a space and there is no space at the end of the line.
Sample Input
10
Sample Output
! " # $ % & ' ( ) *
+ , - . / 0 1 2 3 4
5 6 7 8 9 : ; < = >
? @ A B C D E F G H
I J K L M N O P Q R
S T U V W X Y Z [
] ^ _ ` a b c d e f
g h i j k l m n o p
q r s t u v w x y z
{ | } ~
// Date:2020/3/19
// Author:xiezhg5
#include <stdio.h>
int main(void)
{
int i;
int n=0;
int m;
scanf("%d",&m);
for(i=33;i<=126;i++) //查ASCII表可知范围
{
printf("%2c ",i); //将整数转换为字符串输出
n++;
if(n%m==0)
printf("n"); //每输出n个数字后换行
}
printf("n");
return 0;
}
Expansion: ASCII (American Standard Code for information interchange) is a set of computer coding system based on Latin alphabet, mainly used to display modern English and other Western European languages. It is the most common single byte coding system nowadays and is equivalent to the international standard ISO / IEC 646.
For more information, go to this website:
添加链接描述
最后
以上就是奋斗泥猴桃为你收集整理的[Loops]D. Liang 4.14 Displaying the ASCII character table.c[Loops]D. Liang 4.14 Displaying the ASCII character tableDescription的全部内容,希望文章能够帮你解决[Loops]D. Liang 4.14 Displaying the ASCII character table.c[Loops]D. Liang 4.14 Displaying the ASCII character tableDescription所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复