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
Which of these are correctly formatted Python tuples? CHECK ALL THAT APPY.
grin007 [14]
I think C is correct I looked into some Python and that would seam like the most logical answer
4 0
3 years ago
Read 2 more answers
Mation about which osi layers of connected cisco devices can be verified with the show cdp neighbors comm
fgiga [73]
The show CDP neighbor command operates at the Data link layer (Layer 2)

Cisco Discovery Protocol (CDP) is a proprietary Data Link Layer protocol developed by Cisco Systems. It is used to share information about other directly connected Cisco equipment, such as the operating system version and IP address.

6 0
3 years ago
Gps receivers are commonly used by individuals to determine their geographic location while hiking and to obtain driving directi
soldier1979 [14.2K]
I think it is true also.
7 0
3 years ago
Gaven's instructor told him to include a personal statement in his work portfolio. Why did his instructor recommend including a
algol [13]
The recommendation of the instructor for Gaven to include a personal statement in his work portfolio will allow him to identify his career goals. If he is unable to show this to his work portfolio then he may simply state it in the personal statement. Thus, the answer to this item is letter A. 
3 0
3 years ago
________ is the process of inspecting data that has been input to a program to make sure it is valid before using it in a comput
Mumz [18]

Answer:

Hence, <u>Input Validation</u> is the process of inspecting data that has been input to a program to make sure it is valid before using it in a computation.

Explanation:

The input should be validated before further processing to avoid problems in execution of program afterwards.

The process of input validation is defined to make sure that the input is valid.

Hence, <u>Input Validation</u> is the process of inspecting data that has been input to a program to make sure it is valid before using it in a computation ..

3 0
3 years ago
Other questions:
  • What dose it need For a device to be considered a kind of computer
    14·2 answers
  • How to connect to my wireless printer for dummies?
    12·1 answer
  • Please help me complete this task for ICT! Its about Hardware and Software
    12·1 answer
  • The total revenues for a company are $150,223 and the total expenses were 125,766. If you are calculating the net income, which
    10·1 answer
  • List the steps in setting up an online banking account
    12·2 answers
  • Recommend how could you integrate positive aspects of digital literacy into your own
    13·1 answer
  • 1. Write the full forms of the following.
    5·2 answers
  • Today's manufacturing workplace is most likely to include
    8·1 answer
  • Assume the size of an integer array is stored in $s0 and the address of the first element of the array in the memory is stored i
    10·1 answer
  • How can you distinguish between a manually added page break and an automatic page break in a worksheet?.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!