19.04.08-小练习
1./*编译器:VC6.0*/
#include<stdio.h>
#include<stdlib.h>
int main()
{
int grade=0;
scanf("%d",&grade);
if(grade<0||grade>100)
{printf("成绩输入出错\n");}
else
{
if(grade<=60)
{printf("E\n");}
else
{
if(grade<70)
{printf("D\n");}
else
{
if(grade<80)
{printf("C\n");}
else
{
if(grade<90)
{printf("B\n");}
else
{printf("A\n");}
}
}
}
}
return 0;
}
2./*编译器:VC6.0*/
#include<stdio.h>
#include<stdlib.h>
int main()
{
int day;
scanf("%d",&day);
switch(day)
{
case 1:printf("Monday\n");break;
case 2:printf("Tuesday\n");break;
case 3:printf("Wednesday\n");break;
case 4:printf("Thursday\n");break;
case 5:printf("Friday\n");break;
case 6:printf("Saturday\n");break;
case 7:printf("Sunday\n");break;
default:printf("输入出错\n");
}
rerurn 0;
}
3./*编译器:VC6.0*/
#include<stdio.h>
int main()
{
for(int i=0;i<100;++i)
{
if(i%7==0)printf("%d\t",i);
}
return 0;
}
/*编译器:VC6.0*/
#include<stdio.h>
int main()
{
int i=0;
while(i<100)
{
if(i%7==0)printf("%d\t",i);
i++;
}
return 0;
}
4./*编译器:VC6.0*/
#include<stdio.h>
int main()
{
int a,b,c;
for(int i=0;i<1000;i++)
{
a=i/100;
c=i%10;
b=i/10%10;
if(i==a*a*a+b*b*b+c*c*c)printf("%d\t",i);
}
return 0;
}