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
Radda [10]
4 years ago
15

Given input of a number, display that number of spaces followed by an asterisk. (1 point) Write your solution within the existin

g supplied function called problem2() and run the Zybooks test for it before continuing on to the next problem. Hint: Use the setw() command to set the field width. Alternatively, you could again use a loop.
Computers and Technology
1 answer:
Naddika [18.5K]4 years ago
7 0

Answer:

Following is the program in C++ language

#include <iostream> // header file

#include <iomanip> // header file  

using namespace std; // namespace std;

void problem2() // function definition  

{

int num ; // variable declaration  

cout << "Enter the Number: ";

cin >> num; // Read the input by user

cout << "Resulatant is:";

for(int k = 0; k <num; k++) // iterarting the loop

{

std::cout << std::setw(num); // set width

std::cout <<"*"; // print *

}

}

int main() // main function

{

problem2();// function calling

return 0;

}

Output:

Enter the Number:  3

Resulatant is:    *   *   *

Explanation:

Following is the description of program

  • Create a function problem2().
  • Declared a variable "num" of "int" type .
  • Read the input in "num" by the user .
  • Iterating the for loop and set the width by using setw() and print the asterisk.
  • In the main function  calling the problem2().
You might be interested in
Given the IPv4 address in CIDR notation 215.200.110.50/25, identify the subnet ID that this address belongs to.
stich3 [128]
215.200.110.00, 215.100.110.64, 215.200.110.128,215.100.110.192
7 0
2 years ago
Write programs in python to display “Valid Voter”. (condition : age of person should be
muminat

Answer:

X = int(input("Age = ")

if (X >= 18):

print('Valid Voter')

Else:

return 0

Try it and let me know. :)

4 0
3 years ago
Mobile devices need to work within limited screen space ? true or false
wariber [46]
False. Trust me my friend
4 0
4 years ago
Read 2 more answers
What is the first phone ever made?
pickupchik [31]

Answer:

the Telephone

Explanation:

Before the invention of electromagnetic telephones, mechanical acoustic devices existed for transmitting speech and music over a greater distance greater than that of normal direct speech. The earliest mechanical telephones were based on sound transmission through pipes or other physical media.The acoustic tin can telephone, or "lovers' phone", has been known for centuries. It connects two diaphragms with a taut string or wire, which transmits sound by mechanical vibrations from one to the other along the wire (and not by a modulated electric current). The classic example is the children's toy made by connecting the bottoms of two paper cups, metal cans, or plastic bottles with tautly held string.Some of the earliest known experiments were conducted by the British physicist and polymath Robert Hooke from 1664 to 1685. An acoustic string phone made in 1667 is attributed to him.For a few years in the late 1800s, acoustic telephones were marketed commercially as a competitor to the electrical telephone. When the Bell telephone patents expired and many new telephone manufacturers began competing, acoustic telephone makers quickly went out of business. Their maximum range was very limited. An example of one such company was the Pulsion Telephone Supply Company created by Lemuel Mellett in Massachusetts, which designed its version in 1888 and deployed it on railroad right-of-ways.Additionally, speaking tubes have long been common, especially within buildings and aboard ships, and they are still in use today. The telephone emerged from the making and successive improvements of the electrical telegraph. In 1804, Spanish polymath and scientist Francisco Salva Campillo constructed an electrochemical telegraph.The first working telegraph was built by the English inventor Francis Ronalds in 1816 and used static electricity. An electromagnetic telegraph was created by Baron Schilling in 1832. Carl Friedrich Gauss and Wilhelm Weber built another electromagnetic telegraph in 1833 in Göttingen.At the University of Gottingen, the two have been working together in the field of magnetism. They built the first telegraph to connect the observatory and the Institute of physics, which was able to send eight words per minute.

3 0
3 years ago
If (accountBalance &lt; 1000.00):
andreyandreev [35.5K]

Answer:

See explanation

Explanation:

Given

The code segment

Required

The output

The code segment is incomplete, as the value of accountBalance is not given.

However, I will explain the given segment using few illustrations.

The following will be executed if accountBalance is less than 1000.00

<em>if (accountBalance < 1000.00): </em>

<em>    print(“SAVINGS3”)</em>

Take for instance:

accountBalance = 500.0; "SAVINGS3" will be printed

The following will be executed if accountBalance is less than 2000.00 but more than or equal to 1000.00

<em>elif (accountBalance < 2000.00): </em>

<em>    print(“SAVINGS2”)  </em>

Take for instance:

accountBalance = 1500.0; "SAVINGS2" will be printed

The following will be executed if accountBalance is less than 3000.00 but more than or equal to 2000.00

<em>elif (accountBalance < 3000.00): </em>

<em>     print(“SAVINGS1”) </em>

Take for instance:

accountBalance = 2500.0; "SAVINGS3" will be printed

Lastly, if accountBalance is 3000.00 or greater, the following will be executed

<em>else: </em>

<em>    print(“SAVINGS”)</em>

Take for instance:

accountBalance = 3500.0; "SAVINGS" will be printed

7 0
3 years ago
Other questions:
  • An initialization expression may be omitted from the for loop if no initialization is required.
    15·1 answer
  • Why is a port scan detected from the same ip on a subnet an alarming alert to receive from yourids?
    5·1 answer
  • True / False
    5·1 answer
  • Write a recursive function that takes a non-negative integer as an argument and displays the same number in reverse order (i.e.
    15·1 answer
  • Fast we need help What is binary code? Why do computers use binary code?
    8·2 answers
  • Consider the following code segment.
    12·1 answer
  • Define the function max2 that takes two integers as arguments and returns the largest of them. Then define the function max_list t
    11·1 answer
  • Key Categories: more libraries and thousands of functions
    5·1 answer
  • The <br> is an image at the top of the page that includes the title.
    14·1 answer
  • Define computer memory and write it's type ​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!