实验三
#include<stdio.h>
int main(int argc, char* argv[])
{
int a;
long s=0;
for(a=22;a<=1002;a=a+20)
s=s+a;
printf("%d\n",s);
return 0;
}
#include<stdio.h>
int main(int argc, char* argv[])
{
int a=22;
long s=0;
while(a<=1002)
{
s=s+a;
a=a+20;
}
printf("%d\n",s);
return 0;
}
#include<stdio.h>
int main(int argc, char* argv[])
{
int a=22;
long s=0;
do
{
s=s+a;
a=a+20;
}
while(a<=1002);
printf("%d\n",s);
return 0;
}
#include<stdio.h>
int main(int argc, char* argv[])
{
int a,b,c,j,k,l;
c=0;
for(a=100;a<=999;a++)
{
j=a/100;
k=(a/10)%10;
l=a%10;
b=l*l*l+j*j*j+k*k*k;
if(a==b)
{
printf("%d\n",a);
c=c+1;
}
}
printf("%d\n",c);
return 0;
}
#include<stdio.h>
int main(int argc, char* argv[])
{
int j,k,l,a,b;
b=0;
for(j=1;j<=5;j++)
{
for(k=1;k<=5;k++)
{
if(j==k)
continue;
for(l=1;l<=5;l++)
{
if((j==l)||(k==l))
continue;
a=j*100+k*10+l;
printf("%d\n",a);
b++;
}
}
}
printf("%d\n",b);
return 0;
}