code4sk/c/sourcecode/朱森森带领的奇妙冒险/2022-2023第二学期单开班第1次月考/输出三角形字符阵列.cpp
2023-12-15 22:38:26 +08:00

43 lines
731 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* 7-8 输出三角形字符阵列
分数 10
作者 颜晖
单位 浙大城市学院
本题要求编写程序输出n行由大写字母A开始构成的三角形字符阵列。
输入格式:
输入在一行中给出一个正整数n1≤n<7
输出格式:
输出n行由大写字母A开始构成的三角形字符阵列。格式见输出样例其中每个字母后面都有一个空格。
输入样例:
4
输出样例:
A B C D
E F G
H I
J
代码长度限制
16 KB
时间限制
400 ms
内存限制
64 MB */
#include <stdio.h>
int main()
{
int n;
scanf("%d", &n);
char c = 'A';
for (int i = n; i > 0; i--)
{
for (int j = i; j > 0; j--)
{
printf("%c ", c);
c++;
}
printf("\n");
}
return 0;
}