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]
2 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]2 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
DHCP and FTP servers listen for and send network traffic on:
julsineya [31]

Answer: Well known ports

Explanation:

DHCP server transmit the response to the dynamic host configuration server protocol (DHCP) clients. DHCP default port is 67 and its port number is greater than the user data-gram specific port.

FTP server has its default listen at port 21 and file transition protocol(FTP) uses two transmission control protocol(TCP) connection for communication in the network. FTP passes information in port number 21, which is only used to send control information.

Well known port are use to identify the service of network on the public internet and private internet network. Therefore, port 21 and 67 are the well known ports.

 

5 0
3 years ago
What command do we use to enter data from the keyboard?
SVEN [57.7K]
D I would think……… good luck
6 0
2 years ago
Which term refers to a type of an attack in which an attacker makes his data look like it is coming from a different source addr
Andrew [12]

<u>Man-in-the-middle attack</u> refers to a type of an attack in which an attacker makes his data look like it is coming from a different source address, and is able to intercept information transferred between two computers.

<u>Explanation:</u>

A man-in-the-middle attack (MITM) is an assault where the aggressor furtively transfers and potentially changes the correspondences between two gatherings who accept that they are straightforwardly speaking with one another. This happens when the assailant catches a segment of a correspondence between two gatherings and retransmits it sometime in the future. The assailant would then be able to screen and perhaps change the substance of messages. The utilization of such encoded burrows makes extra secure layers when you get to your organization's secret systems over connections like Wi-Fi.

8 0
2 years ago
Why when I put a question in the search bar it says something went wrong?
xz_007 [3.2K]
It’s says the same thing to me too!
8 0
2 years ago
Harold wants to create a design that would depict the innocent and evil sides of human nature. Which colors can Harold use to de
belka [17]

Answer:

Usually good and evil are depicted as black and white or red and white. White being good, or pure.

Explanation:

8 0
2 years ago
Other questions:
  • Which cloud computing service model gives software developers access to multiple operating systems for testing?
    5·1 answer
  • Which best describes the relationship between maximum cost-per-click (max. cpc) bids and ad rank?
    12·1 answer
  • How does kinetic energy affect the stopping distance of a small vehicle compared to a large vehicle?
    14·2 answers
  • What is the analysis stage in System development life cycle?
    12·1 answer
  • Charles would like to move his internet browser window so that he can see his desktop.He should
    5·1 answer
  • Which of the following barriers to oral communication is not the fault of the sender or receiver? being unprepared noise not pay
    12·2 answers
  • How can injection attacks be prevented? Check all that apply
    6·2 answers
  • HELP PLEASE
    7·1 answer
  • What is polymerization1​
    11·1 answer
  • Programming that relies on the use of objects and methods to control complexity and solve problems is known as what type of prog
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!