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
kirill115 [55]
2 years ago
15

When writing code, how can printing be useful?

Computers and Technology
1 answer:
Citrus2011 [14]2 years ago
3 0

Answer:

See Explanation

Explanation:

Printing while writing code can be useful in several ways.

One of which is to determine the progress of your code. Many a times when you write a code and some parts of your codes are not working as expected, you can use the print statement to track where the program stopped working properly.

Take for instance, you write a program of 50 lines of code and you suspect that the program stops working at line 30, you can use the print statement to track this program.

Please note that: the statement to be printed is not specific but you should make use of something unique that you can easily spot.

E.g

print("It worked up till this point")

You might be interested in
Write a converter program for temperatures. This program should prompt the user for a temperature in Celsius. It should then con
Aleksandr [31]

Answer:

c = float(input("Enter the temperature in Celsius: "))

f = c * 1.8 + 32

print("The temperature in Fahrenheit: " + str(f))

k = (f - 32) / 1.8 + 273.15

print("The temperature in Kelvin: " + str(k))

Explanation:

*The code is in Python.

Ask the user to enter the temperature in Celsius

Convert the Celsius to Fahrenheit using the conversion formula and print it

Convert the Fahrenheit to Kelvin using the conversion formula and print it

3 0
3 years ago
Write the definition of a function that takes as input the three numbers. The function returns true if the first number to the p
sattari [20]

Answer:

I am writing a C++ program.

Here is the function CheckPower() which is a bool return type function which means it will return either true of false. This function has three double type parameters. This function returns true if the first number to the power of the second number equals the third number; otherwise, it returns false.

bool CheckPower(double number1, double number2, double number3)

{

   double power; // stores value of number1 to the power number2

   power = pow(number1,number2); // pow() function to computer power

   if (power==number3) // if the value of power is equal to third no number3

       return true; // returns true

   else // if above condition evaluate to false then returns false

       return false;

}

Explanation:

Lets take the values of number1 = 3, number2 = 2 and number3 = 9 to understand the above function.

The pow() function is a power function to calculate the result of number1 raised to the power of number2. Here number1 is the base number and number2 is exponent number. As number1 = 3 and number2 = 2 so this is equivalent to 3² . So 3 raise to the power 2 is 9. The value stored in power is 9.

power = 9

Next, the if condition checks if the value in power is equal to the value of number3. The value of number3 is 9 and the value in power variable is also 9 so the If condition evaluates to true. So the if part is executed which returns true.

If the value of number3 is, lets say, 10 then the If condition evaluates false as the value of power is not equal to value of number3. So the else part is executed which returns false.

If you want to see the output of this function you can write a main() function as following:

int main()

{   double num1, num2, num3;

   cout << "enter first number: ";

   cin >> num1;

   cout << "enter second number: ";

   cin >> num2;

   cout << "enter third number: ";

   cin >> num3;

   if(CheckPower(num1, num2, num3))

   { cout<<"True";    }

   else

   { cout<<"False";  }    }

This is a main() function which asks the user to enter the values of three numbers num1, num2 and num3. The if condition calls CheckPower() function to check if the first number to the power of the second number equals the third number. If this condition evaluates to true, the message True is displayed on the screen otherwise message False is displayed on output screen.

The screen shot of program along with its output is attached.

3 0
3 years ago
at the grocery store alexa by 1 1/3 lb of ground turkey nasha by two times as much ground turkey is alexa how much ground turkey
Alexeev081 [22]
tasha buys 2 2/3 much ground turkey
8 0
3 years ago
knowledge contributes vitally to the development of __________ memory, or recollections of personally experienced events that oc
Anettt [7]

Answer:

Episodic

Explanation:

Episodic memory are memory that enables a person to remember most important event that happen to them, which are unique to them and are tied to a specific time and place.

It can be the memory of every day events or experiences that occured to the person at a particular time and date.

Example:

Episodic memory is when an individual remember his /her date of birth or specific events and experiences.

Therefore Knowledge contributes vitally to the development of EPISODIC memory, or recollections of personally experienced events that occurred at a specific time and place.

5 0
3 years ago
Rikki has had several problems at work recently. Her printer isn't printing correctly, copies from the copy machine come out wit
Ghella [55]
Create a maintenance schedule 
3 0
3 years ago
Read 2 more answers
Other questions:
  • Row array gameScores contains all player scores. Construct a row array highScores than contains all player scores greater than m
    15·1 answer
  • There are two types of short-term memory: one type is involved in the input and storage of new information, the other type of sh
    9·1 answer
  • __________ has become a widely accepted evaluation standard for training and education related to the security of information sy
    5·1 answer
  • Which of the following is false about ERP II systems? Question 18 options: 1) They utilize the Web. 2) They include human resour
    9·1 answer
  • A friend was just promoted to a new job that requires part-time travel, and he has also been promised a new laptop after his fir
    10·1 answer
  • A=1/2h(a+b) solve for h
    6·1 answer
  • Universal Containers uses a custom object within the product development team. Product development, executives, and System Admin
    11·1 answer
  • Which steps are correct for creating a document from a user-defined template?
    15·1 answer
  • Icon view, list view, and details view are all common views provided by which kind of program?
    12·2 answers
  • Ethics related to all <br> artificial intelligence?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!