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
A cell reference is also called a cell _______.
viva [34]
A cell reference is also called a cell address.
7 0
3 years ago
4.8 code practice question 2 edhesive
Vladimir [108]

Answer:

for y in range(88, 43, -4):

   print(y, end=" ")

Explanation:

yw

6 0
2 years ago
Why do some people argue that tech companies like Apple should do more to address the smartphone addiction problem?
Neko [114]

Answer:

Cause It Will Help Make A Fix For The Issue

Explanation:

Does This Help?

5 0
3 years ago
What is a computer software?​
Fofino [41]

Answer:

Software, instructions that tell a computer what to do The term was coined to differentiate these instructions from hardware  the physical components of a computer system.

Explanation:

6 0
3 years ago
Read 2 more answers
Carol purchases a computer. She installs speech recognition software on the computer.
Leno4ka [110]

<u>B. Microphone</u> helps Carol to use the speech recognition software.

<u>Explanation</u>:

A microphone is a hardware device which converts the sound waves in the air into electronic signals. The electrical signals are transferred to a recording medium. Four main types of microphones are as follows:

i) Cardioid

ii) Super cardioid

iii) Omni

iv) Figure 8

Handheld microphone can be used better with the home theater or a karaoke machine. The speech recognition software can be used with the help of microphone. Cabling problem can be avoided with the use of microphone, thus cable trip hazard can also be avoided.

5 0
3 years ago
Other questions:
  • Litmus-type test strips are used to test coolant for freeze protection and ?
    12·1 answer
  • Which is a good guideline to follow when choosing a background for your slides?. . A. Use a different background for each slide.
    8·1 answer
  • A girl scout troop with 10 girl scouts and 2 leaders goes on a hike. When the path narrows, they must walk in single file with a
    12·1 answer
  • A network that typically reaches a few meters, such as up to 10 meters (33 feet), and consists of personal devices such as mobil
    14·1 answer
  • A commercial depicts a teenager on a skateboard vandalizing a brick wall. This is an example of:
    11·2 answers
  • Listed items that are not in any particular order should be identified with
    8·1 answer
  • Which of the following is as result of division of Labour​
    5·1 answer
  • When all the system testing and bugs correction has done, the software product will be delivered to the user for __________.
    15·1 answer
  • ANSWER QUICKLY!!! <br><br> Which aspect of planning is a preventive action?
    15·1 answer
  • A program that organizes sequences of automated provisioning tasks. A. Application Packager B. Sequence Manager C. Sequence Logg
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!