條件:明天下雨 敘述:帶雨傘
if(condition) statement;
if (condition) statement1; else statement2;
int main() { int year; scanf("%d", &year); // 輸入年份year if (year%400 == 0 ) { printf("%d是閏年\n", year); } else if( (year%4 == 0) && (year%100 != 0)){ printf("%d是閏年\n", year); } else { printf("%d不是閏年\n", year); } }
while (condition) statement1;
就跟 if 一樣 回家自己想想囉