|
Beysik dasturi 10 INPUT “N=”; N:DIM A(N)
|
bet | 6/6 | Sana | 23.05.2024 | Hajmi | 1,57 Mb. | | #251329 |
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 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 !
|
| |