实验三
#include <stdio.h>
int main(){
int long s=0;int i;for(i=22;i<=1002;i=i+20){s=s+i;}printf("%d\n",s);return 0;}
#include <stdio.h>
int main(){
int long s=0;int i=22;while(i<=1002){s=s+i;i=i+20;}printf("%d\n",s);return 0;}
#include <stdio.h>
int main(){
int long s=0;int i=22;do{s=s+i;i=i+20;}while(i<=1002);printf("%d\n",s);return 0;}
#include <stdio.h>
#include <math.h>
int main(){
int a,b,c,n,i;
for(n=100,i=0;n<=999;n++){
a=(n%10);
b=(n/10%10);
c=(n/100);
if(n==pow(a,3)+pow(b,3)+pow(c,3)){
printf("%d\n",n);
i++;}
}
printf("%d\n",i);
return 0;
}
#include <stdio.h>
int main(){
int a,b,c,d;
int e = 0;
for(a = 1; a <= 5; a++){
for(b = 1; b <= 5; b++){
if(a != b){
for(c = 1; c <= 5; c++){
if(a != b && b != c && a != c){
printf("%d\n", d = a*100 + b*10 + c);
e++;
}
}
}
}
}
printf("%d\n", e);
return 0;
}
posted on 2019-05-06 14:42 p201821440017 阅读(114) 评论(0) 编辑 收藏 举报