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
timofeeve [1]
3 years ago
14

This program will output a right triangle based on user specified height triangleHeight and symbol triangleChar. (1) The given p

rogram outputs a fixed-height triangle using a * character. Modify the given program to output a right triangle that instead uses the user-specified triangleChar character. (1 pt) (2) Modify the program to use a nested loop to output a right triangle of height triangleHeight. The first line will have one user-specified character, such as % or *. Each subsequent line will have one additional user-specified character until the number in the triangle's base reaches triangleHeight. Output a space after each user-specified character, including after the line's last user-specified character. (2 pts) Example output for triangleChar = % and triangleHeight = 5: Enter a character: % Enter triangle height: 5 % % % % % % % % % % % % % % % LAB ACTIVITY 4.15.1: Ch 4 Warm up: Drawing a right triangle (C)
#include

int main(void) {
char triangleChar;
int triangleHeight;

printf("Enter a character:\n");
scanf("%c", &triangleChar);

printf("Enter triangle height:\n");
scanf("%d", &triangleHeight);
printf("\n");

//you solution here
return 0;
}
Computers and Technology
1 answer:
vesna_86 [32]3 years ago
5 0

Answer:

#include <stdio.h>

int main(void) {

   char triangleChar;

   int triangleHeight;

   printf("Enter a character:\n");

   scanf(" %c", &triangleChar);

   printf("Enter triangle height:\n");

   scanf("%d", &triangleHeight);

   printf("\n");

   int i, j;

   for(i = 0; i < triangleHeight; ++i) {

       for(j = 0; j <= i; ++j) {

           printf("%c ", triangleChar);

       }

       printf("\n");

   }

   return 0;

}

Explanation:

  • Get the character and height as an input from user.
  • Run the outer loop up to the height of triangle.
  • Run the inner loop up to the value of i variable and then display the character inside this loop.
You might be interested in
you just bought a new hard drive for your computer .you plan to use this as a secondary hard drive to store alll your files. wha
marin [14]
In case the first drive fails, the data will all be backed up onto the second drive, a copy will still be intact.
7 0
3 years ago
Hey good to mett you
ella [17]

Answer:

You too?

Explanation:

4 0
3 years ago
______ devices are high-performance storage servers that are individually connected to a network to provide storage for the comp
natali 33 [55]
NAS - network attached storage
3 0
3 years ago
A(n) _____ chart is drawn on the same worksheet as the data.
Harrizon [31]
The answer is An embedded chart
6 0
3 years ago
A database planner names a field “Organic ingredients_3”. Why would this name Create possible problems in programming?
o-na [289]

Answer:

I think the answer is 2.

hope it will help you

4 0
2 years ago
Read 2 more answers
Other questions:
  • The class Date has a single constructor that accepts the integer value: a month- (1 for January through 12 for December), a day
    13·1 answer
  • What would be the desired output of a home security system?
    6·1 answer
  • What's the best way to change the font size of all your notes pages at once?
    6·1 answer
  • How do you change between worksheets inside an excel workbook?
    13·2 answers
  • Which do web servers host?<br> Websites<br> Networks<br> Firewalls<br> Zones
    8·1 answer
  • The force required to slide an object is equal to _____.
    13·1 answer
  • Brainly bug <br> i had to take a pic because it said it was rude
    10·1 answer
  • Accenture has put together a coalition of several ecosystem partners to implement the principles of blockchain and Multi-party S
    10·1 answer
  • 9.
    8·1 answer
  • A classic game, Wario Land, has an invincible main character who reacts to the environment in order to solve puzzles. So, for ex
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!