1、
#include <stdio.h> #include < String > #define H_PER_M 60 int main () { int min, hour; the printf ( " Enter the number of minutes: " ); Scanf ( " % D " , & min); getchar ( ); the while (min> 0 ) { hour = min / H_PER_M; min = min% H_PER_M; the printf ( " total% d hours,% d minutes \ n- " , hour, min); the printf ( " Please continue to enter \ n- "); scanf("%d", &min); getchar(); } printf("结束"); return 0; }
2、
#include <stdio.h> #include < String > #define H_PER_M 60 int main () { int A, I; the printf ( " Please enter an integer: " ); Scanf ( " % D " , & I); getchar ( ); A = I + 10 ; the printf ( " % D " , I); // this is to let the asterisk is present between the two numbers only the while (I < A) { the printf ( " * " ); I + + ; printf ("%d", i); } getchar(); return 0; }
3、
#include <stdio.h> #include <string> int main() { int weeks,days,day; printf("请输入工作天数:"); scanf("%d", &days); getchar(); weeks = days/7; day = days % 7; printf("%d days are %d weeks, %d days",days,weeks,day); getchar(); return 0; }
4、