C Program to Convert Minutes into Hours and Minutes

The program converts minute to hours & minute format and prints the result on the output screen. It uses basic formula for converting the given minute input to the respective hours.

hours = minute / 60

Write a program that takes minutes as input and converts it into hours and minutes.

Program:

#include<stdio.h>
int main()
{
int minute;
printf("\n\n\tEnter minutes = ");
scanf("%d",&minute);
printf("\n\t Entered minutes = %d minutes \n\t Which is equivalent to = %d hours and %d minutes",minute,minute/60,minute%60);
return 0;
}

Output:

minute to hour

 

Explanation:

  1. Getting input from a user
  2. Then, simply dividing it by 60, that would give quotient as hours and remainder(using modulo operator) as minutes

Leave a Reply