回 帖 发 新 帖 刷新版面

主题:找水仙花数

找水仙花数

回复列表 (共10个回复)

沙发

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.

板凳

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 楼

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 楼

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 楼

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 楼

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 楼

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 楼

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 楼

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 楼

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.




好歹给点分

我来回复

您尚未登录,请登录后再回复。点此登录或注册