1.教材p52  例4-8 分数转成等级 switch

#include<stdio.h>

main()

{

int mark;

printf("请输入学生的分数(0-100):\n");

scanf("%d",&mark);

switch(mark/10)

{

case 10:

case 9:printf("A\n");

case 8:printf("B\n");

case 7:printf("C\n");

case 6:printf("D\n");

default:printf("NO PASS!\n");

}

}

#include<stdio.h>

main()

{

float x,y;

printf("请输入x的值:\n");

scanf("%f",&x);

if(x>0)

y=x*x+1;

else if(x==0)

y=0;

else

y=-x*x-10;

printf("x=%f\ny=%f\n",x,y);

}

#include<stdio.h>

main()

{

float a,b,c,min;

scanf("%f%f%f",&a,&b,&c);

min=a<b?a:b;

min=min<c?min:c;

printf("Min:%f\n",min); #include<stdio.h>

main()

{

int m;

scanf("%d",&m);

if(m%4==0&&m%6==0)

printf("Yes\n");

else

printf("No\n");

}

#include<stdio.h>

main()

{

int a;

scanf("%d",&a);

if(a%400==0||(a%4==0&&a%100!=0)){

printf("%d是闰年!\n",a);

}else{

printf("%d不是闰年!\n",a);

}

}

#include<stdio.h>

main()

{

float a,b,c,min;

scanf("%f%f%f",&a,&b,&c);

min=a<b?a:b;

min=min<c?min:c;

printf("Min:%f\n",min);

}

#include<stdio.h>

main()

{

int m;

scanf("%d",&m);

if(m%4==0&&m%6==0)

printf("Yes\n");

else

printf("No\n");

}