1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Levart [38]
3 years ago
15

Write a program that gets a single character from the user. If the character is not a capital letter (between 'A' and 'Z'), then

the program does nothing. Otherwise, the program will print a triangle of characters that looks like this:
Computers and Technology
1 answer:
Sholpan [36]3 years ago
4 0

This question is incomplete. The complete question is given below:

Write a program that gets a single character from the user. If the character is not a capital letter (between 'A' and 'Z'), then the program does nothing. Otherwise, the program will print a triangle of characters that looks like this:

  A

 ABA

ABCBA

ABCDCBA

Answer:

#include <stdio.h>

void printTri(char asciiCharacter){

   // Row printer

//   for(int i = 65; i <= ((int)asciiCharacter); i++){

   int i = 65;

   while(i <= ((int)asciiCharacter)){

       int leftMargin = ((int)asciiCharacter) - i; +

       int j = 1;

       while(j <= leftMargin){

           printf(" ");

           j++;

       }

       int k = 65;

       while(k < ((int)i)){

           printf("%c",(char)k);

           k++;

       }

       int l = ((int)i);

       while(l >= 65){

           printf("%c",(char)l);

           l--;

       }

       printf("\n");

       i++;

   }

}

int main()

{

   for(;;){

       printf("Please enter a character between A and Z. Enter (!) to exit \n");

       char in;

//       scanf("%c",&in);

       in = getchar();

       getchar();

       printf("Printing Triangle for: %c \n",in);

       if(((int)in) >= 65 && ((int)in) <= 90){

           printTri(in);

           printf("\n");

       }else if(((int)in) == 33){

           break;

       } else {

           continue;

       }

   }

   return 0;

}

Explanation:

  • Inside the printTri function, print spaces, characters in order as well as characters in reverse order.
  • Inside the main function, take the character as an input from user then print the triangle by validating first to ensure that the character lies between a to z alphabets.
You might be interested in
Does anyone else have edge and think its not the awful?
oksano4ka [1.4K]

Answer:

yea

Explanation:

3 0
3 years ago
Read 2 more answers
Which feature of a blog allows an author to interact and get feedback from his or her readers? link pingback commenting TweetMem
poizon [28]
Commenting. When someone comments of a blog the blog's writer can comment back, to answer questions, etc.
6 0
2 years ago
For the past five days, the Howard family has traveled these miles: 389;126;419;93; and 394. Find the range and how. Show all yo
Fofino [41]
The answer is 326.

Range is found by subtracting the smallest number in the data set from the largest number.

Highest number: 419
Lowest number: 93

419-93
=326

(Next time make sure to post this under the Mathematics section.)
5 0
3 years ago
What is the best way to limit a google search and get the most specific information possible?
Marrrta [24]
You go into settings on the google search and click advanced search. The rest you do on your own.
6 0
3 years ago
Assuming each reference costs 1 byte, and each piece of data/info costs 1 byte as well. When will a doubly linked list be more a
NeX [460]

Answer:

The circular individually linked list is more efficient for time sharing process ,when multiple application are running on pc it is responsibility of an output system to put all process on a list and execute them all by giving them piece of time and make them wait when cpu is selected to other process.

It will be more suitable for output system to use circular list as when it reaches to last of list it will be manually reaches to starting node or process.

Singly circular linked list is used when we are concerned with the memory as only one process will be allocated memory at once and there are no chances of process to go never-ending waiting.

Explanation:

8 0
3 years ago
Other questions:
  • Which element of the security policy framework requires approval from upper management and applies to the entire organization?A.
    5·1 answer
  • The magnavox odyssey was a commercial success
    13·1 answer
  • Read the following paragraph:
    9·2 answers
  • Pls help! ive been looking everywhere online but I couldn't find the answer to this:
    5·1 answer
  • Bluetooth © and Wifi are two examples of transmission protocols. Which of the following statements about them is true?
    9·1 answer
  • What happens when two computers have the same IP address?
    13·1 answer
  • Why do you classify computers?
    6·1 answer
  • Claire wants to use a conditional statement in JavaScript that provides a block of statement to be executed if the condition is
    7·2 answers
  • GIVING BRAINLIEST
    15·1 answer
  • LAB: Phone number breakdown Given a long long integer representing a 10-digit phone number, output the area code, prefix, and li
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!