判断闰年和if···else语句.

29 阅读1分钟

#include <stdio.h> int main10(){ int year; print("请输入一个年份: "); scanf("%d", &year); // int c1 = year % 4 ==0 && year % 100 != 0; int c2 = year % 400 == 0 ; printf("%d\n",year); c1|| c2 ? printf("是") : printf("不是") printf("是闰年**");**

// c1 // c2 "%d年是闰年\n",year: printf"%d年不是闰年\n",year;

}

#include <stdio.h> #include <stdlib.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {

// int i = 0; printf("请输入一个分数:"); scanf("%d", &i); if(i == 100){ printf("满分\n"); } else if(i >= 80){ printf("高分\n"); } else{ printf("挨打\n"); } //

int a = 0;
printf("请输入正方形的边长:");
scanf("%f", &a);

int b = 0;
printf("请输入长方形的边长:");
scanf("%f", &b);

int c = 0;
printf("请输入长方形的边长:");
scanf("%f", &c);

if (a *a > b*c) {
    printf("rectangle\n");
} else if (a*a < b*c) {
    printf("square\n");
} else {
    printf("same\n");
}
 
return 0;

}