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
djverab [1.8K]
3 years ago
7

Write a function named printtriangle that receives a parameter that holds a non-negative integer value and prints a triangle of

asterisks as follows: first a line of n asterisks, followed by a line of n-1 askterisks, and then a line of n-2 asterisks, and so on.
Computers and Technology
1 answer:
NemiM [27]3 years ago
5 0
Static void PrintTriangle(int n){    for(;n>0;n--) {                Console.WriteLine(new String('*', n));    }}
You might be interested in
Write a program that asks the user to enter a person’s age. The program should display a message indicating whether the person i
MariettaO [177]

Answer:

The c++ program for the given scenario is given below.

#include <iostream>

using namespace std;

int main() {

   int age;

   string person;

   cout << "This program prints whether the person is an infant, a child, a teenager or an adult based on the age entered by the user." << endl;

   cout << "Enter the age in completed years" << endl;

   cin >> age;

   if( age>=0 && age<=1 )

       person = "infant";

   else if( age>1 && age<13 )

       person = "child";

   else if( age>=13 && age<20 )

       person = "teenager";

   else

       person = "adult";        

   cout << "The person is " << person << " at the age of " << age << endl;

   return 0;

}

OUTPUT

This program prints whether the person is an infant, a child, a teenager or an adult based on the age entered by the user.

Enter the age in completed years

1

The person is infant at the age of 1  

Explanation:

This program prints the phase of the human life based on the age entered by the user. The program executes as follows.

1. User is prompted to enter the age in completed years. The program does not validates the user inputted age since it is not specifically mentioned in the question.

2. An integer variable, age, is declared which is initialized to the age entered by the user.

3. A string variable, person, is declared which is initialized to the phase of the person based on the entered age. The variable person is not initialized.

4. The age of the user is tested using multiple if else statements. Based on the age criteria given in the question, the variable person is assigned a value. This value represents the phase of the person which is equivalent to the age.

5. The program terminates with a return statement since the main method has the return type of integer.

3 0
3 years ago
Compare and contrast the ways that television both shaped and reflected American life in the 1950s, 1960s, and 1980s. In your op
mojhsa [17]
In the 1950's, it was known as the Golden Era. People would buy more electronics in the US. And at this time also, the TV dinner was introduced, changing our ways of having dinner with the family.
In the 1960's we see an end of innocence, and a changing world. Americans would witness a changing social life. They would also watch the television more than read a newspaper.
In the 1980's, though little was innovated in television, Americans saw the introduction of game consoles, and the increasing popularity of sitcoms.

In my opinion, television today depicts the ever-advancing minds of the people, with newer technologies getting introduced in a short time span. This also reflects an ever-changing society not just in the US, but also in the world.

Hope this answer helps.
4 0
3 years ago
Suppose packets are transmitted in error from A to B with a probability of 0.01. Estimate the throughput of this go-back-3 proto
Ede4ka [16]

Answer:Check the attached

Explanation:

5 0
3 years ago
A ________ performs a wide range of activities such as programming, testing, database design, communications and networks, proje
Anton [14]

Answer:

Consultant

Explanation:

Consultant is an external analyst who evaluate a company's systems to help them meet their business objectives. It primary duties include analysing and diagnosing a company's  infrastructure, understanding a client's business needs and designing and implementing a technology solution. An example of a consultant is an<em> IT Consultant</em> .

An<em> IT Consultant</em> evaluate a company's IT systems to help them meet their business objectives.

4 0
4 years ago
Suppose the following array is declared:
Nimfa-mama [501]
83.

grades.length will return the number of elements in the array, starting from 1, unlike when you actually use the array, where the index starts from 0.

This means grades.length will return 4, as there are 4 elements in the array. We are subtracting 1 from this number, meaning we are finding the value of grades[3], which would equal 83, as an array index starts from 0, where

88 = grades[0]
92 = grades[1]
82 = grades[2]
and 83 = grades[3]

3 0
4 years ago
Other questions:
  • There are well-known classes of problems that are intractably difficult for computers, and other classes that are provably undec
    5·1 answer
  • Which question is most closely related to the field of biology? A.How thick is a paper bag? B.What determines the growth rate of
    10·2 answers
  • Television has greatly influenced how politicians are perceived via the sound bite and ________ campaigning.
    11·1 answer
  • What is working with others to find a mutually agreeable outcome?
    5·1 answer
  • Write C++ a function name int min_divisor(int n) that returns the minimum divisor of a number recursively without using any buil
    15·1 answer
  • 897,100 rounded to the nearest hundred thousand is
    8·1 answer
  • Example of negative body language include all but
    8·1 answer
  • Fill _________ skips the Saturday and Sunday dates in a date fill.
    10·1 answer
  • A bitmap image is provided in two different resolutions. Image 1 has a resolution of 1500 x 1225. Image 2 has a resolution of 50
    15·1 answer
  • As a highly flexible structure, __________ can be quickly configured to adapt as required due to changes.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!