Viết CT đếm các bộ số Pytago từ 1->n (Bằng FPC)

Viết CT đếm các bộ số Pytago từ 1->n (Bằng FPC)

0 bình luận về “Viết CT đếm các bộ số Pytago từ 1->n (Bằng FPC)”

  1. program Bai_10_PiTaGo;
    uses crt;
    var a,b,c,n,DEM :integer;
    begin
            clrscr;
            write(‘Nhap so n: ‘);readln(n);
            For c:=1 to n do
            For b:=1 to c do
            For a:=1 to b do
            if (c*c=a*a+b*b) then
            begin
            DEM:=DEM+1;
            write(‘,’,a,’,’,b,’,’,c,”);
            end;
            write(‘Cac bo so Pitago tu 1->n dem duoc la: ‘,DEM);
            readln;
    end.

    Bình luận
  2. program dem_pytago;
    uses crt;
    var n,dem,x:longint;
    begin
    clrscr;
       write(‘N=’);readln(n);
       x:=5;
       while x<=n do
         begin
            inc(dem);
            x:=x*2;
         end;
       writeln(‘So bo so pytago tu 1 toi n la:’,dem);
    readln
    end.

    ///////////////////////////////////////////

    Một số text cho bạn tham khảo:

    viet-ct-dem-cac-bo-so-pytago-tu-1-n-bang-fpcBình luận

Viết một bình luận