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 system analyst generally needs to have a number of skills. For example, technical and analytical skills are required for this
polet [3.4K]

Answer: See explanation

Explanation:

Systems analysts are the people who analyse how a particular software, or IT system will be able to fit and meet the needs of their company or client. They are charged with the responsibility of writing requirements for new systems.

Some if the skills required for a system analyst include:

• Flexibility

• Strong analytical skills

• Adaptability

• Initiative

• Interpersonal skills.

• Attention to detail.

• Teamwork skills.

• Written and verbal communication skills.

8 0
3 years ago
Which branch of science helps avoid or minimize stress-related injuries at workplace?
eduard

Answer:

PUTANG INA MO MAMATAY KANA KING INA NYONG NGA AMERICANO

3 0
3 years ago
Now tell me how be rich like Bill Gates
Lunna [17]
Get a good education and a good job and stay focused in life
5 0
3 years ago
Complete the function to return the factorial of the parameter using recursion,
Dominik [7]

def recursiveFactorial(number):

   if number > 0:

       return number * (recursiveFactorial(number - 1))

   else:

       return 1

stringNum = input("Enter a positive integer: ")

num = int(stringNum)

print(recursiveFactorial(num))

I hope this helps!

5 0
3 years ago
Read 2 more answers
a publication usually issued daily,weekly or other regular times that provides news,views,features and other information of publ
leonid [27]

Answer:

adsfafdfads

Explanation:

afdafdsa

8 0
3 years ago
Other questions:
  • An effectively distributed resume will get an interview
    12·2 answers
  • I have a problem with importing excel file into Access. I have some table in Excel and I want to import it into Access. When I d
    6·2 answers
  • What are the features of the Outline view in Word? Select three options.
    12·2 answers
  • IN THE MOVIE BACK TO THE FUTURE 1985 IS 1985 THE PUBLICATION DATE?WHERE CAN I FIND THE MOVIE?
    6·1 answer
  • Which device makes computers that are connected to separate segments appear and behave as if they're on the same segment? (Pleas
    11·1 answer
  • In the writing and language test of the SAT, questions ask students to do which of the following? A. Write an essay B. Define a
    14·2 answers
  • What is data analysing data and give three examples ?​
    9·1 answer
  • Which of the following are NOT possible using the RANDOM(a, b) and DISPLAY(expression) abstractions?
    10·1 answer
  • How i simplify this boolean expression ?A'.B'.C'+A'.B'.C+A'.B.C+A.B'.C+A.B.C
    6·2 answers
  • Yusuke has been a fan of online games for as long as she can remember. She particularly loves the role-playing games that allow
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!