var n,i,j:longint; c:string; begin readln(n);{读入行数} n:=n div 2; for i:=-n to n do begin for j:=-abs(i) to 1 do write(' '); for j:=1 to abs(i)*2+1 do write(c); writeln; end; readln; end.
程序应该是想打印类似的图形。不过程序有误,我改了一下,仅供参考: var n,i,j:longint; c:char; begin c:='#'; readln(n);{读入半个沙漏的行数} for i:=-n to n do begin for j:=1 to n-abs(i) do write(' '); for j:=1 to abs(i)*2+1 do write(c); writeln; end; readln; end.
var x,y:longint; begin writeln('Find the greatest common divisor of tow numbers'); write('What two numbers are?'); readln(x,y); while not(x=y)do if x>y then x:=x-y else y:=y-x; write('Thier greatest common multple is ',x); readln; end.
欧,还有这个: uses,crt; var i,k:longint; j:longint; x:boolean; c:string; begin writeln('你想要彩色吗?T:要;F:不要。'); readln(c); i:=1; while i<2147483646 do begin i:=i+1; x:=true; for j:=2 to i-1 do if i mod j=0 then begin x:=false;end; if x then begin if c='T' then begin randomize; c:=random(0..15); textcolor(c);end; k:=k+1;write('第',k,'个质数是:',i);readln;end; end; readln; writeln('这些就是1到2147483646的所有质数。'); readln; writeln; end.
终于啊!约瑟夫问题编好了: var m:array[1..50]of shortint; x,i,n,j,k:longint; begin readln(n,x); for i:=1 to n do m[i]:=1; i:=0; while not(j=1) do begin j:=0; inc(k); if k>n then k:=1; inc(i); if m[k]=0 then dec(i); if i mod x=0 then begin m[k]:=0;for i:=1 to n do j:=j+m[i];i:=0; end; end; for i:=1 to n do if m[i]=1 then write (i); readln; writeln; end.