C Program to Convert Minutes into Hours – Programmerbay https://programmerbay.com A Tech Bay for Tech Savvy Wed, 24 Aug 2022 20:22:29 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.5 https://programmerbay.com/wp-content/uploads/2019/09/cropped-without-transparent-32x32.jpg C Program to Convert Minutes into Hours – Programmerbay https://programmerbay.com 32 32 C Program to Convert Minutes into Hours and Minutes https://programmerbay.com/c-program-to-convert-minutes-into-hours/ https://programmerbay.com/c-program-to-convert-minutes-into-hours/#respond Sat, 20 Aug 2022 08:15:45 +0000 https://programmerbay.com/?p=5362 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

]]>
https://programmerbay.com/c-program-to-convert-minutes-into-hours/feed/ 0