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
In which of the following situations is having a good credit score important?
Triss [41]
<span>The correct answer is to be able to loan from banks. Having a good credit score, impacts one's approval for bank loans. It will enable a person to have a higher chance of getting his or her loan, approved by the banks, than those who have low credit scores. </span>
8 0
3 years ago
The case states that google intended the limited initial rollout to be a beta test of google glass, meaning that the adopters we
tigry1 [53]

Google intended the limited initial rollout to be a test of google glass, that the adopters were Innovators. The initial rollout of Google Glass was limited, purposefully so as to set the price very high. This mean that only a selected few, and those with plenty of disposable income, would be the first to use these devices. Google required people to register for the chance to receive a set. Even if many would want to spend the money on these devices, Google allowed only a selected few to receive them.

7 0
3 years ago
It is a good idea to include your teacher’s name on a title page.
LenaWriter [7]

Answer: I think it all depends on the teacher because I know one of my teachers like when we put their name on our assignments. So I pick true

Explanation:

6 0
3 years ago
Read 2 more answers
¿El auto es un servicio tecnológico? / The car is a technological service?
EleoNora [17]
A car isn’t technological, It runs on gas. Hopes this helps :p
4 0
3 years ago
Carlie was asked to review a software prject for her company and determine what materials are needed. Whihc part of project mana
Helga [31]

Answer:

The answer is "Resources".

Explanation:

All services should definitely be reviewed through Carlie. However many Software Developers, Reviewers, and others are accessible are important to find out. Only then can Carlie find out because needed, the exact timelines. Because whenever establishing precise deadlines, she needs to take a look at the tools, that's why the above given choice is correct.

8 0
3 years ago
Other questions:
  • Rachel works in a bank. She wants to present the idea of implementing an IS to the management. How should Rachel describe the IS
    9·2 answers
  • Which of the following is NOT a web browser?<br> Safari<br> Chrome<br> Bing<br> Firefox
    8·2 answers
  • A serialized object is ________. an object represented as a sequence of bytes used to store the object's data in a file an objec
    5·2 answers
  • ________________are programs that designed to help users to be more productive with their personal tasks
    11·2 answers
  • FOR ALL PLATO USERS:
    10·2 answers
  • Write six causes of data lost
    9·1 answer
  • Which software-development methodology would be best if an organization needed to develop a software tool for a small group of u
    15·1 answer
  • Bored can you talk to me
    5·2 answers
  • Diffreciate between primary source of information and secondary source of information​
    5·1 answer
  • The Backstage view is where you can see information and options pertaining to the user account and settings. How is the Backstag
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!