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
Check ALL of the correct answers.
Lelu [443]

Answer:

2,3,4

Explanation:

Starts at two, goes to four. Thus it prints 2,3,4

8 0
3 years ago
The multitasking, multi-user, operating system developed by Bell Laboratories that operates on a wide variety of computing platf
olasank [31]

Answer:

Unix

Explanation:

UNIX is simply an operating system developed by Bell Laboratories in the 1960s. Ever since then, it has been constantly worked upon and developed. It is an operating system because it is a suite of programs capable of making a computer to function. Unix is considered to be a stable, multi-user, and multi-tasking system for both desktops and laptops and even servers.

8 0
3 years ago
Consider sending a stream of packets from host a to host b using ipsec. typically, a new sa will be established for each packet
nordsb [41]

Consider sending a stream of packets from Host A to Host B using Ipsec. Typically, a new SA will be established for each packet sent in the stream. True or False? Tweet Answer FALSE. REASON: Ipsec SA is first connect with Host A and Host B. So, all packets in the stream use the new SA.

8 0
2 years ago
What character separates the file extension and the filename?
PtichkaEL [24]
A period, Filenamehere.png or .pdf or any other file extension
5 0
3 years ago
Read 2 more answers
How will you apply what you have learned in our topic today in a real life situation? Show your answers in the acronyms provided
alexira [117]
It means get in the kitchen woman that’s what cookery means
8 0
3 years ago
Other questions:
  • Which of the following is an example of a consumer service? computer builder motorcycle manufacturer cabinet maker air condition
    15·2 answers
  • In Florida, you can drive a motorcycle if you have a _____.
    8·1 answer
  • Jose wants to be sure maintains a high credit score as he is planning yo buy a new car soon what should he do to ensure his scor
    13·2 answers
  • What are some examples of lighter-than-air vehicles?
    10·1 answer
  • Stealing passwords by using software code to run through various password schemes with numbers, symbols, capital letters, and ch
    6·1 answer
  • The domain name service (dns is a distributed database that allows users to communicate with each other computers by:
    7·1 answer
  • The parameter passing mechanisn used in C is
    5·2 answers
  • Write a program that allows the user to enter the last names of five candidates in a local election and the votes received by ea
    12·1 answer
  • Siapa mahapatih brainly.com atau yg disebut Brainly Amerika Serikat ?​
    5·1 answer
  • For computer forensics, ____________ is the task of collecting digital evidence from electronic media.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!