以分钟为单位转换时间,将分钟以小时和分钟表

#include stdio.hint main(void) {const int minperhour = 60;int minutes, hours, mins;//printf(Enter the number of minutes to convert: );

编程学习网为您整理以下代码实例,主要实现:以分钟为单位转换时间,将分钟以小时和分钟表示。,希望可以帮到各位朋友。

#include <stdio.h>  

int main(voID) {  

    const int minperhour = 60;  
    int minutes, hours, mins;  
      //
    printf("Enter the number of minutes to convert: ");  
    scanf("%d", &minutes);  

    while (minutes > 0 ) {  
        hours = minutes / minperhour;  
        mins = minutes % minperhour;  
        printf("%d minutes = %d hours, %d minutes\n", minutes, hours, mins);  
        printf("Enter next minutes value (0 to quit): ");  
        scanf("%d", &minutes);  
    }  
    printf("Bye\n");  

    return 0;  
}
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐