主题:找水仙花数
hugtful
[专家分:0] 发布于 2005-10-11 13:39:00
找水仙花数
回复列表 (共10个回复)
沙发
wywy [专家分:340] 发布于 2005-10-11 13:42:00
Program ss;
Var
C,b,a,I,t:integer;
Begin
Writeln(‘enter a number’);
Readln(i);
Repeat
C:=trunc(i/100);
B:=trunc(1/10)-c*10;
A:=I-trunc(i/10)*10;
T:=c*c+b*b+a*a*a;
If I=t
Then writeln(c,b,a);
I:=I+1;
Until I:>999
End.
板凳
wywy [专家分:340] 发布于 2005-10-11 13:42:00
Program ss;
Var
C,b,a,I,t:integer;
Begin
Writeln(‘enter a number’);
Readln(i);
Repeat
C:=trunc(i/100);
B:=trunc(1/10)-c*10;
A:=I-trunc(i/10)*10;
T:=c*c+b*b+a*a*a;
If I=t
Then writeln(c,b,a);
I:=I+1;
Until I:>999
End.
3 楼
wywy [专家分:340] 发布于 2005-10-11 13:42:00
Program ss;
Var
C,b,a,I,t:integer;
Begin
Writeln(‘enter a number’);
Readln(i);
Repeat
C:=trunc(i/100);
B:=trunc(1/10)-c*10;
A:=I-trunc(i/10)*10;
T:=c*c+b*b+a*a*a;
If I=t
Then writeln(c,b,a);
I:=I+1;
Until I:>999
End.
4 楼
wywy [专家分:340] 发布于 2005-10-11 13:42:00
Program ss;
Var
C,b,a,I,t:integer;
Begin
Writeln(‘enter a number’);
Readln(i);
Repeat
C:=trunc(i/100);
B:=trunc(1/10)-c*10;
A:=I-trunc(i/10)*10;
T:=c*c+b*b+a*a*a;
If I=t
Then writeln(c,b,a);
I:=I+1;
Until I:>999
End.
5 楼
wywy [专家分:340] 发布于 2005-10-11 13:42:00
Program ss;
Var
C,b,a,I,t:integer;
Begin
Writeln(‘enter a number’);
Readln(i);
Repeat
C:=trunc(i/100);
B:=trunc(1/10)-c*10;
A:=I-trunc(i/10)*10;
T:=c*c+b*b+a*a*a;
If I=t
Then writeln(c,b,a);
I:=I+1;
Until I:>999
End.
6 楼
wywy [专家分:340] 发布于 2005-10-11 13:42:00
Program ss;
Var
C,b,a,I,t:integer;
Begin
Writeln(‘enter a number’);
Readln(i);
Repeat
C:=trunc(i/100);
B:=trunc(1/10)-c*10;
A:=I-trunc(i/10)*10;
T:=c*c+b*b+a*a*a;
If I=t
Then writeln(c,b,a);
I:=I+1;
Until I:>999
End.
7 楼
wywy [专家分:340] 发布于 2005-10-11 13:42:00
Program ss;
Var
C,b,a,I,t:integer;
Begin
Writeln(‘enter a number’);
Readln(i);
Repeat
C:=trunc(i/100);
B:=trunc(1/10)-c*10;
A:=I-trunc(i/10)*10;
T:=c*c+b*b+a*a*a;
If I=t
Then writeln(c,b,a);
I:=I+1;
Until I:>999
End.
8 楼
williamgood [专家分:330] 发布于 2005-10-12 13:42:00
program rzy15;
var
c,b,a,i,t:integer;
begin
i:=100;
repeat
c:=trunc(i/100);
b:=trunc(i/10)-c*10;
a:=i-trunc(i/10)*10;
t:=c*c*c+b*b*b+a*a*a;
if i = t
then writeln( i , '=' , c, '^3+' , b , '^3+' , a , '^3' );
i:=i+1;
until i>999;
end .
[em13]
9 楼
williamgood [专家分:330] 发布于 2005-10-12 13:43:00
program mm;
var a,b,c:integer;
begin
for a:=1 to 9 do
for b:=1 to 9 do
for c:=1 to 9 do
if a*a*a+b*b*b+c*c*c=100*a+10*b+c then
writeln('ok',100*a+10*b+c );
readln;
end.
10 楼
157502970 [专家分:190] 发布于 2005-10-12 20:11:00
program ex;
var
i,a,b,c:integer;
begin
for i:=100 to 999 do
begin
a:=i div 100;
c:=i mod 10;
b:=i div 10 mod 10;
if a*100+b*10+c=a*a*a+b*b*b+c*c*c then writeln(i);
end.
好歹给点分
我来回复