uses crt; var n,i:longint; a:array[1..3]of longint; begin clrscr; write(‘Nhap 3 so: ‘);readln(a[1],a[2],a[3]); write(‘Cac so khong am: ‘); for i:=1 to 3 do if a[i] > -1 then write(a[i],’ ‘); writeln; write(‘Lap phuong cac so am: ‘); for i:=1 to 3 do if a[i] < 0 then write(a[i]*a[i]*a[i],’ ‘); readln end.
Program NhatNgu;
Uses crt;
Var k,m,n,s: longint;
Begin
Clrscr;
Write(‘Nhap k: ‘); Readln(k);
Write(‘Nhap m: ‘); Readln(m);
Write(‘Nhap n: ‘); Readln(n);
s:=0;
If k<0 then s:=s+k*k*k
Else s:=s+k*k;
If m<0 then s:=s+m*m*m
Else s:=s+m*m;
If n<0 then s:=s+n*n*n
Else s:=s+n*n;
Write(‘S = ‘,s);
Readln
End.
uses crt;
var n,i:longint; a:array[1..3]of longint;
begin
clrscr;
write(‘Nhap 3 so: ‘);readln(a[1],a[2],a[3]);
write(‘Cac so khong am: ‘);
for i:=1 to 3 do if a[i] > -1 then write(a[i],’ ‘);
writeln; write(‘Lap phuong cac so am: ‘);
for i:=1 to 3 do if a[i] < 0 then write(a[i]*a[i]*a[i],’ ‘);
readln
end.