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
Answer this question for points lol
Zanzabum

Explanation:

jxjxnxnxnxkxozj nxkakthanksssssss lolll

8 0
3 years ago
Read 2 more answers
Describe shortly about the following Linux directories and theirpurpose,1. lib2. etc3. Boot4. Root5. home
Bingel [31]

Answer:

 Linux directories and their purposes are:

1) lib - Lib file contained the share object library file which necessary to boots system and this directory contain file module stored in the kernel.

2) etc - etc file is the configuration file that they are local in the machines. When the program run these file are stored in the directories. this can be static and do not executable directory.

3) Boot - Boot file are stored in the directory which required processing of linux boot and such files are included in the linux kernel of the file.

4) Root - Root file are the best user root directory and user cannot view this directories from there account. This file usually contain administrative file system.  

5) Home - Home file contained the user directory and it is the default system of linux. Home directory helps user to enable any network system to access there home directories.

5 0
3 years ago
What is the binary representation of the following hexadecimal numbers?
Dahasolnce [82]

Answer:

Corresponding Binary numbers are as following:

A4693FBC=10100100011010010011111110111100.

B697C7A1 = 10110110100101111100011110100001.

Explanation:

A single digit hexadecimal number is a 4 bit binary number.So for each hexadecimal bit we have to find the corresponding 4 bit binary number.

A=1010

4=0100

6=0110

9=1001

3=0011

F=1111

B=1011

C=1100

and write them in the same sequence of their hexadecimal number.

A4693FBC=10100100011010010011111110111100.

B=1011

6=0110

9=1001

7=0111

C=1100

7=0111

A=1010

1=0001

B697C7A1 = 10110110100101111100011110100001.

4 0
3 years ago
Components that enhance the computing experience, such as computer keyboards, speakers, and webcams, are known as
never [62]

Answer:

- Peripheral devices

Explanation:

Peripheral devices are defined as computer devices which are not the element of the essential/basic computer function. These devices can be internal as well as external and are primarily connected to the computer for entering or getting information from the computer. For example, the keyboards or mouse functions to enter data into the computer for processing and receiving information while the output devices like speakers, projectors, printers, etc. are used to get the information out of the computer.

3 0
3 years ago
5. The coordinates of triangle ABC are A(-7, 3), B(3, -7) and C(8. 8)
kati45 [8]

Answer:

b

Explanation:

6 0
3 years ago
Read 2 more answers
Other questions:
  • Which osi reference model layer includes all programs on a computer that interact with the network?
    13·1 answer
  • In a CPMT, a(n) ____ should be a high-level manager with influence and resources that can be used to support the project team, p
    10·1 answer
  • Question 2 (5 points)
    12·1 answer
  • What kind of printers tend to have problems with ink drying out inside the nozzles when the printer is not used for a period?
    15·1 answer
  • What is a traffic controller?what are its functions?
    13·1 answer
  • you have a small network in your business with just a few network devices connected along with 22 linux computers and you want t
    7·1 answer
  • What can hack or code can I use to get a shadow or frost dragon in adopt me
    6·2 answers
  • Which of these is NOT a usual result of having friends at work?
    8·1 answer
  • can you still receive messages on messenger from a person when you deleted the conversation with them? (But not blocked them)
    14·2 answers
  • Where is the flash drive listed in a windows 7 save as dialog box?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!