Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that creates an array with 26 elements and stores the 26 lowerca

ID: 3765276 • Letter: W

Question

Write a program that creates an array with 26 elements and stores the 26 lowercase

letters in it. Also have it show the array contents.

Have a program request the user to enter an uppercase letter. Use nested loops to produce a pyramid pattern like this:

A ABA ABCBA ABCDCBA ABCDEDCBA

The pattern should extend to the character entered. For example, the preceding pattern would result from an input value of E. Hint: Use an outer loop to handle the rows. Use three inner loops in a row, one to handle the spaces, one for printing letters in ascending order, and one for printing letters in descending order. If your system doesn’t use ASCII or a similar system that represents letters in strict number order, see the suggestion in programming exercise 3.

Explanation / Answer

Write a program that creates an array with 26 elements and stores the 26 lowercase

letters in it

#include <stdio.h>

int main()
{
char arr[27];
int i;

for(i=0; i<26; i++)
{
arr[i] = 'a'+i;
}

arr[i]='';

printf("%s ", arr);
}

Have a program request the user to enter an uppercase letter. Use nested loops to produce a pyramid pattern like this:

int main() {
int i, j;
char c;

printf("Enter a letter between A and Z ");
scanf("%c", &c);

for(i = 'A'; i <= c; i++)
{
for(j = 'A'; j<=i; j++)
printf("%c", (char)j);
while(j >= 'A') {
printf("%c", (char)j);
j--;
}
printf("%s", " ");
}
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote