174k views
1 vote
Write a program that calculates and prints the number of minutes in a year.

Assume the following:
1 year = 365 days (Ignore leap years)
1 day = 24 hours
1 hour = 60 minutes
Below is an example of the correct output format:
The number of minutes in a year is X

User SelVazi
by
6.4k points

1 Answer

4 votes

Answer:

#include <stdio.h>

int main() {

int minutes_in_an_hour = 60;

int hours_in_a_day = 24;

int days_in_a_year = 365;

int total_minutes = minutes_in_an_hour * hours_in_a_day * days_in_a_year;

printf("The number of minutes in a year is %d\\", total_minutes);

return 0;

}

Step-by-step explanation:

This program calculates the number of minutes in a year by multiplying the number of minutes in an hour, the number of hours in a day, and the number of days in a year. The result is then stored in the total_minutes variable and printed to the screen with the printf function.

User Mishik
by
7.6k points