C 语言 while 进入死循环,怎么跳出? 5
#include<stdio.h>#defineMIN_SEC60intmain(void){intsec,min,left;printf("Convertseconds...
#include <stdio.h>
#define MIN_SEC 60
int main(void)
{
int sec,min,left;
printf("Convert seconds to minutes and seconds!\n");
printf("please Enter the seconds(<=0 to quit):\n");
scanf("&d", &sec);
while(sec > 0)
{
min = sec / MIN_SEC;
left= sec % MIN_SEC;
printf("%d seconds is %d minutes and is, %d seconds.",sec,
min,left);
printf("please Enter next vaule(<=0 to quit):\n");
scanf("d%",&sec);
}
printf("Done!\n");
return 0;
} 展开
#define MIN_SEC 60
int main(void)
{
int sec,min,left;
printf("Convert seconds to minutes and seconds!\n");
printf("please Enter the seconds(<=0 to quit):\n");
scanf("&d", &sec);
while(sec > 0)
{
min = sec / MIN_SEC;
left= sec % MIN_SEC;
printf("%d seconds is %d minutes and is, %d seconds.",sec,
min,left);
printf("please Enter next vaule(<=0 to quit):\n");
scanf("d%",&sec);
}
printf("Done!\n");
return 0;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询