Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
pascal1
//fpc 3.0.0 program HelloWorld; uses crt; var n,i,ln,nn,b,j,c,x,y,d :integer; a: array[1..100] of integer; begin clrscr; randomize; //Nhap n so nguyen vao day writeln('Nhap n'); n:=5; for i:=1 to n do a[i]:=random(100); for i:=1 to n do writeln(a[i]); //So lon nhat nho nhat ln:=a[1]; for i:=1 to n do if a[i]>ln then ln:=a[i]; nn:=a[1]; for i:=1 to n do if a[i]<nn then nn:=a[i]; writeln('So lon nhat la:',ln); writeln('So nho nhat la:',nn); //Tim so nguyen to for i:=1 to n do begin b:=0; for j:=1 to a[i] do if (a[i] mod j =0) then b:=b+1; if b=2 then writeln(a[i]); if b=2 then c:=c+1; end; Writeln('So so nguyen to la:',c); //Tim vi tri X Writeln('Nhap X'); x:= a[3]; for i:=1 to n do if a[i] = x then writeln('Vi tri cua X là:',i); //Xoa Y ra khoi day Writeln('Nhap Y'); y:=a[2]; for i:=1 to n do if a[i]=y then d:=d+1; for j:=1 to d do for i:=1 to n do if a[i]=y then begin b:=a[i]; c:=a[i+1]; a[i+1]:=b; a[i]:=c; end; n:=n-d; for i:=1 to n do writeln(a[i]); end.
run
|
edit
|
history
|
help
0
ANDRESSA LIMA NEPOMUCENO 600624624
RepeatedLetters
test27b
practica 7 ejercicio B5
Solving Quadratic Equation
сумма чётных и нечётных чисел
0 1 0 0 0 1 1 1
звёздное небо и подсчёт кратных звёзд
Sorting
Akanshapanchal2000@gmail.com