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
What are examples of real-time applications
Savatey [412]

Typical examples of real-time systems include Air Traffic Control Systems, Networked Multimedia Systems, Command Control Systems etc.

3 0
4 years ago
Function of network security​
myrzilka [38]

Answer:ffffffffffffgggggg

Explanation:vvvc

5 0
4 years ago
At the dsl local carrier's office, the __________ demultiplexes the data streams and converts them into digital data.
den301095 [7]

At the DSL (Digital Subscriber Line) local carrier's office, the  DSLAM demultiplexes the data streams and converts them into digital data.

DSLAM stands for Digital Subscriber Line Access Multiplexer. It is a network device, usually at a telephone company central office that aggregates individual subscriber lines  into a high-capacity uplink.

3 0
3 years ago
The two types of objects responsible for collecting data are
andrezito [222]
Hey there,
The answer is <span>tables and forms

Hope this helps :))

~Top
</span>
7 0
3 years ago
Typohunting is registering a domain name that is similar to a trademark or domain name but that is slightly misspelled in hopes
AVprozaik [17]

Answer: False

Explanation: Slightly but intentionally misspelling a domain name with the hope that people accidentally arrive at the site when trying to type the URL of the real site is typosquatting.

Therefore registering a domain name that is similar to a trademark or domain name but that is slightly misspelled in hopes that individuals will accidentally arrive at the site when trying to type the URL of the legitimate site according to the question is Not Typohunting but TypoSquatting.

Typosquatting which is also called URL hijacking, and it is a form of cybersquatting which relies on typographical errors and other mistakes made by Internet users when typing a website address into a web browser.

4 0
3 years ago
Other questions:
  • Create a Java program with threads that looks through a vary large array (100,000,000 elements) to find the smallest number in t
    10·1 answer
  • Answer the following questions which are based on the study "Patients' Engagement with Sweet Talk." Submit your answers to the e
    9·1 answer
  • Of the three types of mutating malware, what type changes its internal code to one of a set number of predefined mutations whene
    9·1 answer
  • Which of the following statements is correct? Group of answer choices An object of type Employee can call the setProjectName met
    11·1 answer
  • Which components can be added to a lightning app on custom object (choose 3 answers)A. Visualforce B. Standard Lightning compone
    6·1 answer
  • When you check the spelling in a document, one of the options is to add unrecognized words to the dictionary. If you were workin
    8·1 answer
  • List and briefly explain four common template elements
    6·1 answer
  • Accenture has put together a coalition of several ecosystem partners to implement the principles of blockchain and Multi-party S
    5·1 answer
  • I need help solving this problem on Picoctf. The question is What happens if you have a small exponent? There is a twist though,
    7·1 answer
  • How would you identify communication equipment?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!