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
Please check my answer! (Java)
Nat2105 [25]

9 is the correct answer. 4*2=8 loops are executed, moving the count from 1 to 9.

8 0
3 years ago
A marketing firm has been hired to help a client understand how their online brand is perceived. The firm has set up a system to
KiRa [710]

Answer:

Automated Reasoning

Explanation:

Automated reasoning is a type of Natural language understanding(NLP) in computer science that makes logical inferences based on information or data previously gathered. Automated reasoning allows computers make intelligent decisions and reason logically based on data gathered. For example, a system is based to scan online reviews and conclude on the ones that are negative reactions based on previous data.

3 0
3 years ago
Help me please. i need you help​
Fudgin [204]

Answer:

Can you provide the code

7 0
3 years ago
You can run a macro by:
oee [108]

Selecting the button assigned

Using the shortcut Keys assigned

Explanation:

By clicking the assigned button one can run a macro and we can assign a short cut key to macro which we created.

So, the two options we can use to run a macro.

7 0
2 years ago
Value: 3
Citrus2011 [14]

Answer:

B - A word is correctly spelled but is used incorrectly in a document

4 0
3 years ago
Other questions:
  • Charli's password was changed a couple of weeks ago because someone figured it out. Can someone go to a password generator and f
    5·2 answers
  • 5. ADD A STATEMENT OR STATEMENTS to the program on the following page (including constant and/or variable declarations if you wa
    6·1 answer
  • What happens when two computers have the same IP address?
    13·1 answer
  • This is your code. &gt;&gt;&gt; A = ['dog''red'] &gt;&gt;&gt; B = [' cat', 'blue']&gt;&gt;&gt;C = ['fish', 'green'] You can impl
    10·2 answers
  • The term Linux Intrusion Detection System ( LIDS) refers to a command that allows an administrator to run processes as root with
    5·1 answer
  • Which of the following component is required to insert text in multimedia
    8·1 answer
  • Write a statement that slices a substring out of the string quote and puts it into a variable named selection. If given the stri
    8·1 answer
  • How to transfer mysql database from one server to another
    6·1 answer
  • What can I do If my Texas Instrument TI-84 calculator is not giving accurate answers?
    6·1 answer
  • Different the policies and protocols in the industry
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!