if语句
例一
#include<stdio.h>
int main(){
int year;
printf("输入年份:");
scanf("%d",&year);
if(year%4==0 && year%4==0 || year%100==0)
printf("%d是闰年",year);
return 0;
}
例二
#include<stdio.h>
int main(){
int num;
printf("输入数值:");
scanf("%d",&num);
if(num>=0)
printf("|%d|=%d",num,num);
else
printf("|%d|=%d",num,-num);
return 0;
}
例三
#include<stdio.h>
int main(){
float x;
printf("输入x:");
scanf("%g",&x);
float y=1/x;
printf("y=f(x)=1/%g=%g",x,y);
return 0;
}
标签:num,语言,int,scanf,printf,从零开始,year,include From: https://blog.csdn.net/z1973895044/article/details/137292699