当前位置:网站首页>第五章

第五章

2020-11-08 20:18:39 半勺咖啡

1.# ··· #include<stdio.h> #define MIn_PER_HOU 60 int main(int argc,char*argv[]){ int hours, minutes, input; printf("CONVERT MINUTES TO HOURS!\n"); printf("PLEASE INPUT THE NUMBER OF MINUTES:"); scanf("%d", &input); while (input > 0) { hours = input / MIn_PER_HOU; minutes = input % MIn_PER_HOU; printf("CONVERT TO %d HOUR AND %d MINUTES\n", hours, minutes); printf("PLEASE CONTINUE INPUT THE NUMBER OF MINUTES:"); scanf("%D", &input); } printf("PROGRAM EXIT!\n"); }

#include<stdio.h>

void main() { int a, b; printf("输入数字:"); scanf("%d", &a); b = a; while (b <= a + 10) { printf("%d\n", b); b++; }

}

#include<stdio.h>

void main() { int b; printf("输入天数:"); scanf("%d", &b); while (b >0) { printf("%d days are %d weeks, %d days.\n", b,b/7,b%7); printf("输入天数:"); scanf("%d", &b); }

}

#include<stdio.h>

void main() { float b; printf("输入身高:"); scanf("%f", &b); while (b > 0) { printf("%.0fcm =%.2f feet,%.2f inches\n", b, b / 30.48, b / 2.54); printf("输入身高:"); scanf("%d", &b); }

}

版权声明
本文为[半勺咖啡]所创,转载请带上原文链接,感谢
https://my.oschina.net/u/4741335/blog/4708318