提示用户输入一个时间的秒数,比如500秒就输入500,然后输出对应的分钟和秒,比如500s就是8分钟20秒

#include <stdio.h>

/*

 提示用户输入一个时间的秒数,比如500秒就输入500,然后输出对应的分钟和秒,比如500s就是8分钟20

 */

int main()

{

    /*

    // c的值固定在10以内

    int a = 96546546;

    

    int c = a % 10;

    */

    

    // 1.提示用户输入时间

    printf("请输入一个时间值(秒):\n");

    

    // 2.接收用户输入的时间

    int time;

    scanf("%d", &time);

    

    // 3.转换成对应的分钟和秒

    int minute = time / 60; // 分钟

    int second = time % 60; // 

    

    printf("%d秒 = %d分钟%d\n", time, minute, second);

    

    return 0;

}

posted @ 2014-05-27 12:50  雯瑶  阅读(963)  评论(0编辑  收藏  举报