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
GalinKa [24]
3 years ago
7

Here is a nested loop example that graphically depicts an integer's magnitude by using asterisks, creating what is commonly call

ed a histogram: Run the program below and observe the output. Modify the program to print one asterisk per 5 units. So if the user enters 40, print 8 asterisks.num = 0while num >= 0: num = int(input('Enter an integer (negative to quit):\n')) if num >= 0: print('Depicted graphically:') for i in range(num): print('*', end=' ') print('\n')print('Goodbye.')
Computers and Technology
1 answer:
bogdanovich [222]3 years ago
7 0

Answer:

Please find the code in the attached file.

Output:

Please find the attached file.

Explanation:

In this code a "num" variable is declared that use while loop that check num value greater than equal to 0.

Inside the loop we input the "num" value from the user-end and use if the value is positive it will define a for loop that calculates the quotient value as integer part, and use the asterisks to print the value.

If input value is negative it print a message that is "Goodbye".

Please find the code link:   https://onlinegdb.com/7MN5dYPch2

You might be interested in
Develop a C program that calculates the final score and the average score for a student from his/her (1)class participation, (2)
Ghella [55]

Answer:

#include <iomanip>

#include<iostream>

using namespace std;

int main(){

char name[100];

float classp, test, assgn, exam, prctscore,ave;

cout<<"Student Name: ";

cin.getline(name,100);

cout<<"Class Participation: "; cin>>classp;

while(classp <0 || classp > 100){  cout<<"Class Participation: "; cin>>classp; }

cout<<"Test: "; cin>>test;

while(test <0 || test > 100){  cout<<"Test: "; cin>>test; }

cout<<"Assignment: "; cin>>assgn;

while(assgn <0 || assgn > 100){  cout<<"Assignment: "; cin>>assgn; }

cout<<"Examination: "; cin>>exam;

while(exam <0 || exam > 100){  cout<<"Examination: "; cin>>exam; }

cout<<"Practice Score: "; cin>>prctscore;

while(prctscore <0 || prctscore > 100){  cout<<"Practice Score: "; cin>>prctscore; }

ave = (int)(classp + test + assgn + exam + prctscore)/5;

cout <<setprecision(1)<<fixed<<"The average score is "<<ave;  

return 0;}

Explanation:

The required parameters such as cin, cout, etc. implies that the program is to be written in C++ (not C).

So, I answered the program using C++.

Line by line explanation is as follows;

This declares name as character of maximum size of 100 characters

char name[100];

This declares the grading items as float

float classp, test, assgn, exam, prctscore,ave;

This prompts the user for student name

cout<<"Student Name: ";

This gets the student name using getline

cin.getline(name,100);

This prompts the user for class participation. The corresponding while loop ensures that the score s between 0 and 100 (inclusive)

<em> cout<<"Class Participation: "; cin>>classp; </em>

<em> while(classp <0 || classp > 100){  cout<<"Class Participation: "; cin>>classp; } </em>

This prompts the user for test. The corresponding while loop ensures that the score s between 0 and 100 (inclusive)

<em> cout<<"Test: "; cin>>test; </em>

<em> while(test <0 || test > 100){  cout<<"Test: "; cin>>test; } </em>

This prompts the user for assignment. The corresponding while loop ensures that the score s between 0 and 100 (inclusive)

<em> cout<<"Assignment: "; cin>>assgn; </em>

<em> while(assgn <0 || assgn > 100){  cout<<"Assignment: "; cin>>assgn; } </em>

This prompts the user for examination. The corresponding while loop ensures that the score s between 0 and 100 (inclusive)

<em> cout<<"Examination: "; cin>>exam; </em>

<em> while(exam <0 || exam > 100){  cout<<"Examination: "; cin>>exam; } </em>

This prompts the user for practice score. The corresponding while loop ensures that the score s between 0 and 100 (inclusive)

<em> cout<<"Practice Score: "; cin>>prctscore; </em>

<em> while(prctscore <0 || prctscore > 100){  cout<<"Practice Score: "; cin>>prctscore; } </em>

This calculates the average of the grading items

ave = (int)(classp + test + assgn + exam + prctscore)/5;

This prints the calculated average

cout <<setprecision(1)<<fixed<<"The average score is "<<ave;  

8 0
3 years ago
Consider the following scenario below and recommend a solution.
sammy [17]

your account has enabled profile pictures for your users, you can manage all profile pictures for your account. Profile pictures are public and automatically approved when users upload an image in their settings. Using profile pictures can make it easier to see the users in your account and managing them gives you the ability to keep the pictures appropriate.

If Gravatars are enabled for an institution in account settings, and a user has a Gravatar but chooses not to upload a profile picture, the Gravatar will display for the user's profile picture.

If a student views another student's user details in a course and reports a profile picture as inappropriate, you can review those profile pictures and approve, lock, or delete the picture. In the courses, instructors can remove profile pictures completely from a user's details page.

5 0
2 years ago
A network administrator is configuring an ACL with the command access-list 10 permit 172.16.32.0 0.0.15.255. Which IPv4 address
lord [1]

Answer:

For this wild card mask 0.0.15.255 the ACE IP address will be 172.16.47.254

Explanation:

ACL is the access control list that is used to enlist the ip addresses that allowed or restricted to access the network. ACE is an IP address from the list ACL that has all rules and regulations related to access of network. The ACE could be in the range of IP address in ACL. ACL can be calculated with the help of initial IP address adding with wild card mask.

So

Initial IP address is = 172.16.32.0

Wild card mask =0.0.15.255

by adding above values we can find the last IP address of ACL.

after addition

Final IP address is = 172.16.47.255

The options that are available with question, Only option between the range is  172.16.47.254. So we can say that This is the only ACE IP address in options.

7 0
3 years ago
How do I delete my account on Brainly? It says I must enter my password to do so, but I never set up a password. When I try the
Lady_Fox [76]
Try using your email account password
8 0
2 years ago
Explain the principles of computer applications ​
9966 [12]

Answer:

The nature of computers and code, what they can and cannot do.

How computer hardware works: chips, cpu, memory, disk.

Necessary jargon: bits, bytes, megabytes, gigabytes.

How software works: what is a program, what is "running"

How digital images work.

Computer code: loops and logic.

Big ideas: abstraction, logic, bugs.

3 0
2 years ago
Other questions:
  • Identify the four basic categories of hardware in a personal computer system
    7·1 answer
  • Which computer applications can Mr. Crowell use to make the classroom learning more stimulating and interesting? Mr. Crowell has
    9·2 answers
  • You are working on an excel table and realize that you need to add a row to the middle of your table. what is one way to do this
    12·1 answer
  • A potential threat to administrators’ ability to manage the correctional system is
    12·1 answer
  • Read the excerpt from The Code Book. Other attacks include the use of viruses and Trojan horses. Eve might design a virus that i
    13·1 answer
  • Servlet session and JSP session have different abilities.TrueFalse
    9·1 answer
  • The only way to print a photo is on a special glossy paper using professional printing services in a store
    9·2 answers
  • _KOH + _Cu(CIO3)2 - __KCIO3 +<br>_Cu(OH)2​
    12·1 answer
  • Johnathan was assigned to complete a project with three other people. What benefit will he get from working with the team?
    15·1 answer
  • Explain any two types of board band connection​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!