我叫王超然,是一名电脑爱好者,现在在新加坡留学上高一.我立志成为一名电脑人才,愿意在这里与大家一同分享我玩转电脑的心得.O-level华文考了A-One哈哈!
天气: 晴朗
心情: 高兴
/*P3Q14
* Wang Chaoran
* 14 (Displaying the ACSII character table)
Write a program that prints the characters in the ASCII character table from '!' to '~'.
Print ten characters per line.
*/
public class P3Q14
{
public static void main(String[] args)
{
String output="";
//Store the Symbols in a String
for(int i=(int)('!');i<(int)('~')+1;i++)
{
//Store a line for each 10 symbols
if(i%10==3)
{
output = output + "\n";
}
output = output + (char)(i)+" ";
}
//Print the table of symbols
System.out.println("Prints the characters in the ASCII character table from '!' to '~':"+output);
}
}
导入论坛查看(47)回复(0)引用(0)好评(0) 差评(0)
加入收藏
编辑
审核
TAG:
computing