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
Crazy boy [7]
4 years ago
14

Write a program that asks the user to enter the size of a triangle (an integer from 1 to 50). Display the triangle by writing li

nes of asterisks. The first line will have one asterisk, the next two, and so on, with each line having one more asterisk than the previous line, up to the number entered by the user. On the next line write one fewer asterisk and continue by decreasing the number of asterisks by 1 for each successive line until only one asterisk is printed.
Computers and Technology
1 answer:
lianna [129]4 years ago
7 0

Answer:

/*

* Program to print traingle using asterisk.

*/

#include<iostream>

using  namespace std;

//Function to print n asterisk in a row.

void printAsterisk(int n)

{

   for(int i = 0;i<n;i++)

   cout<<"*";

}

int main()

{

//Variable to store size of trianle

int size;

cout<<"Enter the size of triangle"<<endl;

cin>>size;

//print asterik in increasing order line by line.

for(int i =0; i<size;i++)

{

    printAsterisk(i);

    cout<<endl;

}

//print asterik in decresing order line by line.

for(int i =size-1; i>0;i--)

{

    printAsterisk(i-1);

    cout<<endl;

}

 

 

}

Output:

Enter the size of triangle

10

*

**

***

****

*****

******

*******

********

*********

********

*******

******

*****

****

***

**

*

Explanation:

Since no programming language is mentioned therefore answer is provided in C++.

The above program will use two for loops to print the triangle using asterisk.

The first loop will print the asterisk line by line with each line having one more asterisk than the previous one till the size of the triangle.

The second for loop will print the asterisk using same logic as above but in reverse order.

Final output of triangle will be obtained.

You might be interested in
Describe the difference between information poor and information rich society?​
Nadya [2.5K]

Answer:

The “Information poor” are consumers who use traditional mass media information such as television, DVDs, radios and magazines. ... On the opposite “information rich” stands for a new elite within the information society.

7 0
3 years ago
Read 2 more answers
A study by the Pew Internet and American Life Project reports that ________ percent of Americans research products and services
katrin2010 [14]

Options:

A. 40;35

B. 60;30

C; 70;35

D. 60;35

Answer:D) 60; 35.

Explanation:Pew Research center is a Private, nonpartisan fact tank, which conducts opinion polls on public related issues such Demographic,political,economic, religious and Environmental topics it was established in the year 2014 in Washington DC,United States of America.

Pew research center conducts it's opinion polls and research through various platforms such as Social media,internet, questionnaires etc.

3 0
3 years ago
Tell me the defination of working principle of computer with all information​
Rudik [331]

Answer:

Computer do the work primarily in the machine and we can not see, a control centre that converts the information data input to output.

Explanation:

Please mark as brainlist please please!

7 0
4 years ago
Give a real-world example of a selection control structure.
yuradex [85]

An example of selection structure is when a group of people wanted to know the exact  number of days through the use of a data set that has the daily high temperature which ranges from above 80 degrees, and as such, a programmer can use the if-end statement.

<h3>What is an if statement?</h3>

An IF statement is known to be a kind of statement that is executed due to the happening of a specific condition.

Note that IF statements must start with IF and end with the END.

Therefore, An example of selection structure is when a group of people wanted to know the exact  number of days through the use of a data set that has the daily high temperature which ranges from above 80 degrees, and as such, a programmer can use the if-end statement.

Learn more about  if-end statement from

brainly.com/question/18736215

#SPJ1

6 0
2 years ago
Format Painter cannot be used to copy only character attributes. True or False
andrey2020 [161]
Format painter are used for copying texts, shape and even pictures. It is located on the top left part of your home button of your microsoft product. The statement " Format painter cannot be used to copy only character attributes." is absolutely False. As it can copy things individually.
4 0
4 years ago
Other questions:
  • Climate is considered a(n) _______ limiting factor. (2 points)
    9·1 answer
  • What is the unit of measure that specifies the value of cellspacing?
    9·1 answer
  • The ____ computing device had a memory capacity of 72 numbers and could be programmed to perform a 23-digit multiplication in ju
    6·1 answer
  • What is thhe name of service included with windows server operating systemthat manages a centralized database containing user ac
    5·1 answer
  • Random letter of the alphabet for Python coding
    11·2 answers
  • What is communication ​
    5·2 answers
  • 9. A change in the appearance of a value or label in a cell
    5·1 answer
  • The Institute of Electrical and Electronics Engineers (IEEE) is an organization that researches and institutes electrical standa
    15·2 answers
  • What tool can help discover and report computer errors when you first turn on a computer and before the operating system is laun
    9·2 answers
  • ____ increase network performance by reducing the number of frames transmitted to the rest of the network
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!