//No.1 #includeint main() { int nums[] = { 1,5,6,2,4 }; int i; int max = 0; max = nums[0]; for (i = 1; i < 5; i++) { if (max < nums[i]) max = nums[i]; } printf("%d", max); return 0; }
//No.2 #includeint main() { int a = 1; int b = 2; int c = b; //c=2 b = a; //b=1 a = c; //a=2 printf("%dn", a); printf("%dn", b); return 0; }
//No.3 #includeint main() { int answer=0; if (answer == 1) printf("正确n"); else if (answer == 0) printf("错误n"); return 0; }
No.4 #includeint main() { int a = 0; scanf_s("%d", &a); int hour,minute; hour = a / 60; minute = a % 60; printf("时间为%d小时%d分钟",hour,minute); return 0; }
No.5 #includeint main() { int i=0,j=0; for(i=1;i<=9;i++) { for(j=1;j<=9;j++) printf("%d*%d=%-3d",i,j,i*j); printf("n"); } return 0; }
//No.7 #includeint main() { double a=0, b=0; double c; scanf_s("%lf%lf", &a, &b); c = a + b; printf("sum=%lf", c); return 0; }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)