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
jeyben [28]
3 years ago
5

Write a program that will prompt the user to enter an integer. The program should square the number and then print the squared n

umber. Repeat this process until 0 is entered as input. Use a do-while-loop to do this.
Computers and Technology
1 answer:
Kay [80]3 years ago
3 0

Answer:

// here is code in C++.

#include <bits/stdc++.h>

using namespace std;

// function to compute sum and product

void square(int input)

{

   // variable to store the square of number

   long long squ_num;

   calculate the square of number

   squ_num=pow(input,2);

   // print the output

   cout<<"square of "<< input<<" is: "<<squ_num<<endl;

   

}

// driver function

int main()

{

   int n;

   // read the number until user enter 0

   do{

       cout<<"enter a number!! (0 to stop):";

     // read the input from user

       cin>>n;

       // call the function to calculate square of input number

       square(n);

       

   }while(n!=0);

 

return 0;

}

Explanation:

Declare a variable "n" to read the input number from user.Call the function  square() with parameter "n".In this function, it will calculate the square  of the input number and print it.This will repeat until user enter 0 as  input.Program will ends when user give 0 as input.

Output:

enter a number!! (0 to stop):5                                                                                                                                

square of 5 is: 25                                                                                                                                            

enter a number!! (0 to stop):7                                                                                                                                

square of 7 is: 49                                                                                                                                            

enter a number!! (0 to stop):11                                                                                                                              

square of 11 is: 121                                                                                                                                          

enter a number!! (0 to stop):0

You might be interested in
To make a profit the price of the items sold in the furniture store are marked up by 80 %after marking up the prices each item i
Verdich [7]

Answer:

The algorithm is as follows:

1. Start

2. Display "Input Item Price: "

3. Input Price

4. Markup = Price + 80% * Price

5. Selling_Price = 10% * Markup

6. Display "The Selling Price is "+Selling_Price

7. Stop

Explanation:

This signals the beginning of the algorithm

1. Start

This is a prompt that asks for the price of the item

2. Display "Input Item Price: "

This gets the price of the item

3. Input Price

This calculates the Markup (80% of the inputted price)

4. Markup = Price + 80% * Price

This calculates the selling price (10% of the markup)

5. Selling_Price = 10% * Markup

This prints the selling price

6. Display "The Selling Price is "+Selling_Price

This signals the end of the algorithm

7. Stop

7 0
2 years ago
Sharing resources.
olya-2409 [2.1K]

Answer:

Explanation:

2- Multitasking Multitasking – Multitasking Multitasking is one among the main advantage of computer. ...

Speed – Now computer isn't just a calculating device. ...

Cost/ Stores huge – Amount of knowledge it's a coffee cost solution. ...

Accuracy – ...

Data Security – ...

Task completer – ...

Communication – ...

Productivity –

More items...•

6 0
2 years ago
Why can’t I see one individual’s questions in the app through their profile, but I can see their questions on the website?
Mumz [18]

Answer:

I think thats just a software issue. i have the same problem

Explanation:

7 0
3 years ago
Read 2 more answers
____ is suitable for what are called "high-volume service control applications" such as dial-in access to a corporate network.
Levart [38]

Answer: a. RADIUS

Explanation:

RADIUS as developed with the idea of allowing its users or clients to be able to authenticate to a dial-in access server. So basically it is a client server protocol and he client here is the firebox and the server is the RADIUS server.  

The authentication mechanism start by user who sends a message to the RADIUS server. Then the RADIUS server upon receiving the message accept or denies it. It accepts if the client is configured to the server.

A large amount of additional information can be sent by the RADIUS server in its Access-Accept messages with users so we can say that RADIUS is uitable for what are called "high-volume service control applications" such as dial-in access to a corporate network.

3 0
3 years ago
The letters a, e, i, o and u are the only vowels. Write a function named vowelUseDict() takes a string t as a parameter and comp
Andru [333]

Please specify the programming language.


3 0
3 years ago
Other questions:
  • What is a Photojournalist
    5·1 answer
  • Sites like Zillow get input about house prices from a database and provide nice summaries for readers. Write a program where the
    6·1 answer
  • What is a short sequence of characters that appears at the end of a filename and is preceded by a period called __________
    5·1 answer
  • The file descriptor stderr is represented by the number ____.
    6·1 answer
  • HURRY
    8·1 answer
  • What can happen if you do not follow the directions when cooking or baking? (Give 4 examples in a sentence each)
    8·1 answer
  • Determine of population size​
    11·1 answer
  • 1. Which of the following cables are used in networking? Check all that apply.
    8·2 answers
  • How to beat level 50 in give up robot 2
    5·1 answer
  • A(n) _____ is a data validation rule that should be applied to mandatory data items.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!