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
GUI allows users to communicate with a device and see what they are doing onscreen.
zloy xaker [14]
The answer is true.
Gui basically is the thing that lets you see your desktop and what your doing. The G means graphics. Makes sense. If we didn't have GUI, then we would have to type in code to access documents, and do things on the computer. GUI changes that.
8 0
3 years ago
Your brother is starting 9th grade next year and is thinking about going to college. What step would you recommend he take?
postnew [5]
I would say D. Usually students aren't expected to fill out the FAFSA till junior or senior year, this is because it is based on household income which may change every year. Also, guidance counselor's can help students on the right track to go to classes. Clubs and/or sports teams look really good on college applications and are usually preferred by colleges. 
4 0
2 years ago
Write a for loop that iterates from 1 to numbersamples to double any element's value in datasamples that is less than minvalue.
CaHeK987 [17]

Answer:

function dataSamples=AdjustMinValue(numberSamples, userSamples, minValue)

dataSamples=userSamples;

%for loop

for i=1:numberSamples

%checking if dataSamples value at index,i

%is less than minValue

if dataSamples(i)<minValue

%set double of dataSamples value

dataSamples(i)= 2*dataSamples(i);

end

end

end

Explanation:

The given code is in MATLAB.

4 0
3 years ago
Python is an example of a low level programming language true or false?​
alekssr [168]
False- python is an example of a high level language. Other high levels are c++, PHP, and Java
6 0
3 years ago
Explain the following terms as used in word processin
meriva

Answer:

A drop cap (dropped capital) is a large capital letter used as a decorative element at the beginning of a paragraph or section. The size of a drop cap is usually two or more lines.

a superscript is a character(s) half the height of a standard character and printed higher than the rest of the text.

In word processing, the word indent is used to describe the distance, or number of blank spaces used to separate a paragraph from the left or right margins.

6 0
2 years ago
Other questions:
  • The use of digital technology and the Internet to execute the major business processes in the enterprise is called
    11·1 answer
  • The order in which statements are executed during a program run. Answer 1 The first part of a compound statement begins with a k
    12·1 answer
  • When paying bills online, a payee is:
    9·1 answer
  • What is an instruction set architecture​
    7·2 answers
  • Enthusiasm codehs 7.6.4 Write a function called add_enthusiasm that takes a string and returns that string in all uppercase with
    15·1 answer
  • When you login to your blogging account. The first screen with all controls, tools and functions is called .... Select one: a. D
    10·1 answer
  • A large number of consecutive IP addresses are available starting at 198.16.0.0. Suppose that four organizations, Able, Baker, C
    11·1 answer
  • How will understanding IT help me achieve my goals in life?
    14·1 answer
  • Assume that the Vehicle class contains a virtual method named CalculateMaxSpeed(). Assume that both the MotorVehicle and Automob
    12·1 answer
  • allows users to enter text and control the computer with their voice.allows users to enter text and control the computer with th
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!