programming

write a program that asks the user to enter an objects mass, and then calculates and displays its weight.

Answers

#include using namespace std; int main() { // Declare variables double mass, weight; const double GRAVITY = 9.8; // Prompt user to enter object's mass cout << "Enter the object's mass: "; cin >> mass; // Calculate and display the object's weight weight = mass * GRAVITY; cout << "The object's weight is " << weight << "N." << endl; return 0; } /* This program asks the user to enter an object's mass and then calculates and displays its weight. This is done by taking the user's input mass and multiplying it by the constant value of gravity (9.8). This value is then printed out as the object's weight. */

Answered by Steven Murphy

We have mentors from

Contact support