minute to hour – Programmerbay https://programmerbay.com A Tech Bay for Tech Savvy Wed, 24 Aug 2022 21:04:55 +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 minute to hour – Programmerbay https://programmerbay.com 32 32 C Program to Convert Hours into Minutes https://programmerbay.com/c-program-to-convert-hours-into-minutes/ https://programmerbay.com/c-program-to-convert-hours-into-minutes/#respond Mon, 25 Jul 2022 07:28:06 +0000 https://programmerbay.com/?p=5361 The program accepts hours & minutes as an input and print the result to output screen. It uses basic formula to convert the given input to its corresponding minutes.

1 hour = 60 minutes
hours = minutes * 60

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

Program:

#include<stdio.h>
int main()
{
int hours,minutes, inminutes;
printf("\n\n\t Please enter hours and minutes \n");
printf("\t hours:minutes = ");
scanf("%d:%d",&hours,&minutes);
inminutes=hours*60;
inminutes=inminutes+minutes;
printf("\n\t %d hours:%d minutes = %d minutes",hours,minutes,inminutes);
return 0;
}

Output:

c program to convert hours to minutes

Explanation:

  1. Getting input from a user
  2. Then, simply multiplying it by 60, that would give minutes
  3. Adding the result with existing minutes
  4. Printing the result

Frequently Asked Question

Q1. How to write a C program to convert years into minutes.

1 years is exactly equal to 525960 minutes. Using this concept, we need to multiply the given input to 525960 to get total minutes.

Program:

#include<stdio.h>
int main()
{
long years,minutes;
printf("\n\n\t Please enter years = ");
scanf("%ld",&years);
minutes=years * 525960;
printf("\n\t %ld years = %ld minutes",years,minutes);
return 0;
}

Output:

Please enter years = 3

3 years = 1577880 minutes

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