Learning by doing: Reading books and trying to understand the (code) examples
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

32 lines
506 B

#include <stdio.h>
int main(void) {
char letter;
printf("Give an uppercase char: ");
scanf("%c", &letter);
if (letter < 'A' || letter > 'Z') {
printf("ERROR: No uppercase char\n");
return 1;
}
for (char i = 'A'; i <= letter; i++) {
for (char a = letter - i; a > 0; a--) {
printf(" ");
}
for (char b = 'A'; b <= i ; b++) {
printf("%c", b);
}
for (char c = i - 1; c >= 'A' ; c--) {
printf("%c", c);
}
printf("\n");
}
return 0;
}