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]
4 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]4 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
Lisa has a section of her document that she would like to include in the index. Which option should Lisa choose?
kupik [55]

Answer:

For including a part of the text within the index, you need to make use of the Mark Entry option. And here you can fill the required information for curating your index, you need to just follow the instruction as required, and you will be fine.

Explanation:

Please check the answer.

8 0
3 years ago
Choose all items that represent characteristics of an HTML element. used to include additional information in an attribute consi
Sphinxa [80]

Answer:

Explanation:

We could find different kind of tags in HTML, in this case, we can choose the tag <p> we're going to see all the items about this tag.

We can close the tag with the symbol /

<p> example </p>

We can add id or class in this tag

<p id="example"> example </p>

<p class="example"> example </p>

this help up to add CSS code, but we can add style direct in the HTML code:

<p style="color: red;"> example </p>

In this example the text going to be color red

8 0
4 years ago
Which two keys are commonly used to move or insert data?.
vlabodo [156]

Answer:

control and shift

Explanation:

6 0
3 years ago
George and Miguel want to know more about their local and online competitors and about the retail industry. What is the best way
fgiga [73]
I would go with all of the above because if you want to find out everything you can then you should explore every option you get.
8 0
3 years ago
Read 2 more answers
A/an ____ file saves a workbook as a comma-delimited text file for use on another windows operating system??
aleksandrvk [35]

Answer:

The correct option is D

D) CVS

Explanation:

A CVS file saves a workbook as a comma-delimited text file for use on another windows operating system. It ensures that line breaks, tab characters and other characteristics are interpreted correctly.

A CVS file stands for Comma Separated Value file, which basically allows the data to be saved in tabular format. However they differ from other spreadsheet file types because you can only have a single sheet in a file. Moreover, you cannot save cell, column or row in it.

7 0
3 years ago
Other questions:
  • Which is the last step in conducting a url research
    11·1 answer
  • The Law of Increasing Opportunity Costs requires greater ______ of one good in order to produce ______ of another good.
    11·2 answers
  • Max needs to study more effectively to get a better grade on his next exam. What can he do to improve his study habits? Check al
    10·2 answers
  • While ________ is centered on creating procedures, ________ is centered on creating objects. Procedural programming, class progr
    10·1 answer
  • OSHA requires training for employees on the hazards to which they will be exposed.
    12·2 answers
  • Write a program that removes all spaces from the given input. Ex: If the input is: Hello my name is John. the output is: Hellomy
    11·1 answer
  • Grooves and polished surfaces on desert pebbles are most likely caused by
    10·1 answer
  • Choose all the answers that apply.
    14·1 answer
  • What is the term that is used to describe a computer system that could store literary documents, link them according to logical
    8·1 answer
  • Please can someone help me answer this question.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!