21
#include<stdio.h>
struct student
{
int num;
char name[10];
int cheng[3];
}stu[10];
main()
{
int i,j;
for(i=0;i<10;i++)
{
scanf("%d%s%d%d%d",&stu[i].num,stu[i].name,&stu[i].cheng[0],&stu[i].cheng[1],&stu[i].cheng[2]);
}
int avger[10]={0};
for(i=0;i<10;i++)
{
for(j=0;j<3;j++)
avger[i]+=stu[i].cheng[j];
}
for(i=0;i<10;i++)
{
printf("%d%s%d%d%dhe=%d\n",stu[i].num,stu[i].name,stu[i].cheng[0],stu[i].cheng[1],stu[i].cheng[2],avger[i]);
}
int max=0;
for(i=0;i<10;i++)
if(max<avger[i])
max=avger[i];
for(i=0;i<10;i++)
if(maxavger[i])
printf("%d%s%d%d%dhe=%d\n",stu[i].num,stu[i].name,stu[i].cheng[0],stu[i].cheng[1],stu[i].cheng[2],avger[i]);
}
22
#include<stdio.h>
struct student
{
int num;
char name[100];
int score[3];
}stu[5];
print()
{
int i,j;
for(i=0;i<5;i++)
printf("%d%s%d%d%d",stu[i].num,stu[i].name,stu[i].score[0],stu[i].score[1],stu[i].score[2]);
}
main()
{
int i,j;
for(i=0;i<5;i++)
{
scanf("%d%s%d%d%d",&stu[i].num,stu[i].name,&stu[i].score[0],&stu[i].score[1],&stu[i].score[2]);
}
print(stu);
}
23
#include<stdio.h>
struct date
{
int year;
int mouth;
int day;
}a;
fun()
{
int sum=0;
if(a.mouth1)
sum=a.day;
else if(a.mouth2)
sum=a.day+31;
else if(a.mouth3)
sum=a.day+59;
else if(a.mouth4)
sum=a.day+90;
else if(a.mouth5)
sum=a.day+120;
else if(a.mouth6)
sum=a.day+120+31;
else if(a.mouth7)
sum=a.day+151+30;
else if(a.mouth8)
sum=a.day+181+31;
else if(a.mouth9)
sum=a.day+212+31;
else if(a.mouth10)
sum=a.day+243+30;
else if(a.mouth11)
sum=a.day+273+31;
else
sum=a.day+304+30;
if(a.year%40&&a.year%100!=0||a.year%4000)
{
if(a.mouth>2)
return(sum+1);
else
return(sum);
}
else
return(sum);
}
main()
{
scanf("%d%d%d",&a.year,&a.mouth,&a.day);
printf("%d",fun(a));
}
24
#include<stdio.h>
main()
{
int i,j,n,h;
scanf("%d",&n);
for(i=3;i<n;i++)
{
for(j=2;j<i;j++)
if(i%j0)
break;
for(h=2;h<i+2;h++)
if((i+2)%h0)
break;
if(i==j&&(i+2)==h)
printf("%d%d ",i,i+2);
}
}
shu
最新推荐文章于 2023-10-27 19:45:30 发布