Modify Matt\'s Program of the Week to give the user their weight on the planets
ID: 3649392 • Letter: M
Question
Modify Matt's Program of the Week to give the user their weight on the planets mentioned. Hint: The internet may be the best place to do this simple research.#include <stdio.h>
// Declare Constants
#define MERCURY 88
#define VENUS 225
#define JUPITER 4380
#define SATURN 10767
int main()
{
int age, output;
// Input
printf("Enter your age: ");
scanf("%d", &age);
// CalculatiMercuryon
output = (365 * age) / MERCURY;
// Output
printf("Your age on Mercury would be: %d ", output);
// Calculation
output = (365 * age) / VENUS;
// Output
printf("Your age on Venus would be: %d ", output);
// Calculation
output = (365 * age) / JUPITER;
// Output
printf("Your age on Jupiter would be: %d ", output);
// Calculation
output = (365 * age) / SATURN;
// Output
printf("Your age on Saturn would be: %d ", output);
return 0;
}
Explanation / Answer
#include // Declare Gravity Constants #define MERCURY 0.38 #define VENUS 0.91 #define JUPITER 2.54 #define SATURN 1.08 int main() { float weight, output; // Input printf("Enter your weight: "); scanf("%f", &weight); // Calculate Weight on Mercury output = weight * MERCURY; // Output printf("Your weight on Mercury would be: %f ", output); // Calculate Weight on Venus output = weight * VENUS; // Output printf("Your weight on Venus would be: %f ", output); // Calculate Weight on Jupiter output = weight * JUPITER; // Output printf("Your weight on Jupiter would be: %f ", output); // Calculate Weight on Saturn output = weight * SATURN; // Output printf("Your weight on Saturn would be: %f ", output); return 0; }Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.