# 一份作业(霉霉镇楼)

``````#include <stdio.h>
void  one_houzi_eat_peach();
void  two_shuchu_sushu();
void  three_zhifu_tongji_();
void  four_print_shuixianhua_shu();
void  five_search_themax_or_min_number();
int main()
{
int n;
scanf ("%d",&n);
switch (n)
{
case 1:
one_houzi_eat_peach();
break;
case 2:
two_shuchu_sushu();
break;
case 3:
three_zhifu_tongji_();

break;
case 4:
four_print_shuixianhua_shu();
break;
case 5:
five_search_themax_or_min_number();
break;
if (n==6)
break;
}
return 0;
}
void  one_houzi_eat_peach()
{

int i;
int tao=1;
for (i=0;i<9;i++)
{
tao+=1;
tao*=2;

}
printf ("%d",tao);

}
void  two_shuchu_sushu()
{
for (int i = 2; i>=100&&i<=200; ++i)
{
int flag = 1;

for (int j = 2; j <= sqrt(i); ++j)
{
if (i%j == 0)
{
flag = 0;//用if来判定是否是素数
break;
}
}

if (flag)
{
printf("%dn", i);
}
}
}
void  three_zhifu_tongji_()

{
char c;
int letterCnt = 0, spaceCnt = 0, numCnt = 0, otherCnt = 0;
while ((c = getchar()) != 'n')
{
if ((c >= 'a'&&c <= 'z') || (c >= 'A'&&c <= 'Z'))
{
letterCnt++;
}
else if (c == ' ')
{
spaceCnt++;
}
else if (c >= '0'&&c <= '9')
{
numCnt++;
}
else
{
otherCnt++;
}
}

printf("英文字母个数为%dn", letterCnt);
printf("空格个数为%dn", spaceCnt);
printf("数字个数为%dn", numCnt);
printf("其它字符个数为%d", otherCnt);

}
void four_print_shuixianhua_shu()
{
for (int i = 100; i < 1000; ++i)
{
int units, tens, huns;
huns = i / 100;
tens = i % 100 / 10;
units = i % 10;
if (i == huns*huns*huns + tens*tens*tens + units*units*units)
{
printf("%d ", i);
}
}

}
void  five_search_themax_or_min_number()
{
int n;
scanf ("%d",&n);
int i;
int a[100];
for (i=0;i<n;i++)
{
scanf ("%d",&a[i]);
}
int max,min;
max=min=a[0];
int j;
for (j=0;j<n;j++)
{
if (a[i]>max)
{
a[i]=max;

}

}
int k;
for (k=0;k<n;k++)
{
if (a[i]<min)
{
a[i]=min;

}

}
printf ("max=%dmin=%d",max,min);

}
``````

THE END

)">