• Paskal dasturi
  • End; S:=0; For i:1 to n do
  • Beysik dasturi 10 INPUT “N=”; N:DIM A(N)




    Download 1,57 Mb.
    bet6/6
    Sana23.05.2024
    Hajmi1,57 Mb.
    #251329
    1   2   3   4   5   6
    Bog'liq
    Ma\'ruza №5 Ускунавий дастурий таъминот

    Beysik dasturi

    10 INPUT “N=”; N:DIM A(N)

    20 FOR I=1 TO N

    30 PRINT “A(“;I;”)=”;

    40 INPUT A(I)

    50 NEXT I

    60 S=0

    70 FOR I=1 TO N

    80 S=S+A(I)

    90 NEXT I

    100 PRINT”Сумма”;S

    110 END

    Paskal dasturi

    Paskal dasturi

    Program Summa;

    Type Mas=Array [1…100]Of real;

    Var A :Mas;I, n:Integer;S :Real;

    BEGIN

    Write(,n=,); ReadLn(n);

    For i:=1 to n do

    Begin

    Write(,A[;I;]=,);

    ReadLn(A[i]);

    End;

    S:=0;

    For i:1 to n do

    S:=S+A[i];

    WreteLn(,S=:S:8:2);

    END.

    C++ dasturi

    C++ dasturi

    # include

    # include

    main( )

    {

    float a[ 100], s; int i, n; clrscr( ); printf("n="); scanf("%i", &n);

    for (i = 1; i <= n; i++) {

    printf("a["%i]=", i);

    scanf("%f",&a[i]);}

    s=0;

    for (i = 1; i <= n; i++)

    s = s + a[i];

    printf("s = % f \ n", s); return 0;

    }

    E'TIBORINGIZ UCHUN

    TASHAKKUR !


    Download 1,57 Mb.
    1   2   3   4   5   6




    Download 1,57 Mb.

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    Beysik dasturi 10 INPUT “N=”; N:DIM A(N)

    Download 1,57 Mb.