trong day
uses crt;
var a,b:array[1..100] of real;
i,j,k,n:integer;
kt:boolean;
begin
clrscr;
write('spt n=');readln(n);
for i:=1 to n do
write('a[',i,']=');
readln(a[i]);
end;
kt:=false;
for j:=1 to n do
for k:=1 to n do
if a[i]=a[j]+a[k] then kt:=true;
if kt=true then write('a[',i,']=',a[i]:4:2,' ');
readln;
end.
Của bạn Äây:
ChÆ°Æ¡ng trình Äã Äược Test rá»i Äó bạn.
Chạy Äúng 10000000% luôn:
Program Bai_Tap;
Uses Crt;
Var A:Array[1..100] Of integer;
N,i,x,y: Byte;
B: Boolean;
Begin
Clrscr;
Write('So phan tu cua mang A la: ');
Readln(N);
For i:=1 to n do
Write('A[',i,']= ');
Readln(A[i]);
End;
Writeln('Cac so trong day can tim la: ');
B:= False;
For x:=1 to n do
For y:=1 to n do
If ((x<>y) and (x<>i) and (y<>i) and (A[i]= A[x]+A[y])) then B:=True;
If B= True Then Write(A[i]:6);
Readln
End.
Thân ái..!!!
*****(^.^)
Copyright © 2024 VQUIX.COM - All rights reserved.
Answers & Comments
Verified answer
uses crt;
var a,b:array[1..100] of real;
i,j,k,n:integer;
kt:boolean;
begin
clrscr;
write('spt n=');readln(n);
for i:=1 to n do
begin
write('a[',i,']=');
readln(a[i]);
end;
for i:=1 to n do
begin
kt:=false;
for j:=1 to n do
for k:=1 to n do
if a[i]=a[j]+a[k] then kt:=true;
if kt=true then write('a[',i,']=',a[i]:4:2,' ');
end;
readln;
end.
Của bạn Äây:
ChÆ°Æ¡ng trình Äã Äược Test rá»i Äó bạn.
Chạy Äúng 10000000% luôn:
Program Bai_Tap;
Uses Crt;
Var A:Array[1..100] Of integer;
N,i,x,y: Byte;
B: Boolean;
Begin
Clrscr;
Write('So phan tu cua mang A la: ');
Readln(N);
For i:=1 to n do
Begin
Write('A[',i,']= ');
Readln(A[i]);
End;
Writeln('Cac so trong day can tim la: ');
For i:=1 to n do
Begin
B:= False;
For x:=1 to n do
For y:=1 to n do
If ((x<>y) and (x<>i) and (y<>i) and (A[i]= A[x]+A[y])) then B:=True;
If B= True Then Write(A[i]:6);
End;
Readln
End.
Thân ái..!!!
*****(^.^)