IO-01. 表格输出

本题要求编写程序,按照规定格式输出表格。

输入格式:

本题目没有输入。

输出格式:

要求严格按照给出的格式输出下列表格:

------------------------------------
Province Area(km2) Pop.(10K)
------------------------------------
Anhui 139600.00 6461.00
Beijing 16410.54 1180.70
Chongqing 82400.00 3144.23
Shanghai 6340.50 1360.26
Zhejiang 101800.00 4894.00
------------------------------------

Java代码实现:

 1 public class Main {
 2     public static void main(String[] args) {
 3         System.out.println("------------------------------------\n"
 4                 + "Province      Area(km2)   Pop.(10K)\n"
 5                 + "------------------------------------\n"
 6                 + "Anhui         139600.00   6461.00\n"
 7                 + "Beijing        16410.54   1180.70\n"
 8                 + "Chongqing      82400.00   3144.23\n"
 9                 + "Shanghai        6340.50   1360.26\n"
10                 + "Zhejiang      101800.00   4894.00\n"
11                 + "------------------------------------");
12     }
13 }

 C语言代码实现:

 1 #include 
 2 
 3 int main()
 4 {
 5     printf("------------------------------------\n");
 6     printf("Province      Area(km2)   Pop.(10K)\n");
 7     printf("------------------------------------\n");
 8     printf("Anhui         139600.00   6461.00\n");
 9     printf("Beijing        16410.54   1180.70\n");
10     printf("Chongqing      82400.00   3144.23\n");
11     printf("Shanghai        6340.50   1360.26\n");
12     printf("Zhejiang      101800.00   4894.00\n");
13     printf("------------------------------------\n");
14     return 0;
15 }

 

你可能感兴趣的:(IO-01. 表格输出)