K
Khách

Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.

5 tháng 7 2021

program bai1;

uses crt;

var i,j,d:integer;

a:array[1..100]of real;

t,k:real;

begin

  clrscr;

  i:=1;

  while 1/i>0.0321 do

  begin

    a[i]:=1/i;

    inc(i);

    d:=i;

  end;

  writeln('mang tren co ',d,' so hang');

  i:=1;

  while t+a[i]<=3 do

  begin

    t:=t+a[i];

    inc(i);

  end;

  writeln('so can tim la: ',a[i+1]:5:4);

  writeln(a[i+1]:5:4,' la so hang thu ',i+1);

  write('nhap k:');readln(k);

  for i:=1 to d do

  if (k>a[i])and(k<a[i-1]) then writeln(k:5:4,' nam giua ',a[i]:5:4,' va ',a[i-1]:5:4);

  readln;

end.

5 tháng 7 2021

program bai1;

uses crt;

var i,j,d:integer;

a:array[1..100]of real;

t,k:real;

begin

  clrscr;

  i:=1;

  while 1/i>0.0321 do

  begin

    a[i]:=1/i;

    inc(i);

    d:=i;

  end;

  writeln('mang tren co ',d,' so hang');

  i:=1;

  while t+a[i]<=3 do

  begin

    t:=t+a[i];

    inc(i);

  end;

  writeln('so can tim la: ',a[i+1]:5:4);

  writeln(a[i+1]:5:4,' la so hang thu ',i+1);

  write('nhap k:');readln(k);

  for i:=1 to d do

  if (k>a[i])and(k<a[i-1]) then writeln(k:5:4,' nam giua ',a[i]:5:4,' va ',a[i-1]:5:4);

  readln;

end.

b: #include <bits/stdc++.h>

using namespace std;

long long b[1000],i,n;

int main()

{

cin>>n;

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

cin>>b[i];

sort(b+1,b+n+1);

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

cout<<b[i]<<" ";

return 0;

}

Bài 1: 

#include <bits/stdc++.h>

using namespace std;

long long a[250],i,n,k;

int main()

{

cin>>n>>k;

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

cin>>a[i];

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

if (a[i]==k) cout<<i<<" ";

return 0;

}

uses crt;

var a:array[1..255]of integer;

i,n,max:integer;

begin

clrscr;

repeat

write('Nhap n='); readln(n);

until (1<n) and (n<=255);

for i:=1 to n do 

  begin

write('A[',i,']='); readln(a[i]);

end;

writeln('Day so vua nhap la: ');

for i:=1 to n do 

  write(a[i]:4);

writeln;

max:=a[1];

for i:=1 to n do 

 if max<a[i] then max:=a[i];

writeln('Gia tri lon nhat la: ',max);

readln;

end.

uses crt;

var a:array[1..255]of integer;

i,n,vt:integer;

begin

clrscr;

repeat

write('Nhap n='); readln(n);

until (1<n) and (n<=255);

for i:=1 to n do 

  begin

write('A[',i,']='); readln(a[i]);

end;

writeln('Day so vua nhap la: ');

for i:=1 to n do 

  write(a[i]:4);

writeln;

vt:=n;

for i:=n downto 1 do 

  if a[i]>0 then 

begin

if vt>i then vt:=i;

end;

if (vt=n) and (a[n]<=0) then writeln('Trong day khong co so duong')

else writeln('Chi so so hang duong dau tien trong day la: ',vt);

readln;

end.

Bài 1: 

#include <bits/stdc++.h>

using namespace std;

long long a[250],i,n,k;

int main()

{

cin>>n>>k;

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

cin>>a[i];

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

if (a[i]==k) cout<<i<<" ";

return 0;

}

Bài 1: 

#include <bits/stdc++.h>

using namespace std;

long long a[250],i,n,k;

int main()

{

cin>>n>>k;

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

cin>>a[i];

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

if (a[i]==k) cout<<i<<" ";

return 0;

}

Bài 1: 

#include <bits/stdc++.h>

using namespace std;

long long a[250],i,n,k;

int main()

{

cin>>n>>k;

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

cin>>a[i];

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

if (a[i]==k) cout<<i<<" ";

return 0;

}