Những câu hỏi liên quan
Linh Đan
Xem chi tiết
Võ Đức Dũng
17 tháng 9 2021 lúc 21:33

câu 1

Program Nguyen_to;

Var n,i:integer;

Function NT(n:integer):Boolean;

Var ok: Boolean;

i: integer;

Begin ok:=true;

for i:=2 to n-1 do if (n mod i)= 0 then ok:=ok and false;

if n < 2 then NT:=false else NT:=ok;

End;

Begin Write('Nhap n: ');

Readln(n); i:=n;

Repeat i:=i+1;

Until NT(i);

Write('So nguyen to nho nhat lon hon ',n, 'la: ',i);

Readln End.

Bình luận (1)
Võ Đức Dũng
17 tháng 9 2021 lúc 21:39

câu 2

uses crt;

const so: set of char=['0','1','2','3','4','5','6','7','8','9'];

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

st,b:string;

c,l,i,n,j:integer;

s, Max: integer;

begin clrscr;

write('Nhap xau:');

readln(st);

l:=length(st);

i:=1;

n:=0;

repeat if (st[i] in so) then begin b:=''

repeat b:=b+st[i];

inc(i);

until (not(st[i] in so)) or (i>l);

inc(n);

val(b,a[n],c);

end;

inc(i);

until i>l;

Max:=a[1];

for i:=2 to n do If Max<A[i] Then Max:=A[i];

Writeln('Phan tu lon nhat cua mang:', Max);

readln;

end.

Bình luận (0)
nguyentienlam
Xem chi tiết
nguyentienlam
4 tháng 4 2023 lúc 15:21

cứu m vs

 

Bình luận (0)
Nguyễn Thị Tươi
Xem chi tiết
Nguyễn Lê Phước Thịnh
21 tháng 1 2022 lúc 9:18

#include <bits/stdc++.h>

using namespace std;

long long a[1000],i,n,x;

int main()

{

cin>>n;

for (i=1; i<=n; i++) cin>>a[i];

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

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

{

int x=sqrt(a[i]);

if (x*x==a[i]) 

{

cout<<x;

return 0;

}

}

cout<<"Ko co so chinh phuong trong day";

return 0;

}

Bình luận (1)
ttanjjiro kamado
21 tháng 1 2022 lúc 9:18

uses crt;
var x,i,max,n,dem,dem1,dem2,dem3,t,t1:integer;
a,b,c,d,e:array[-32000..32000]of integer;
tbca,tbcd:real;
begin
clrscr;
write(‘n=’); readln(n);
for i:=1 to n do
begin
write(‘a[‘,i,’]=’); readln(a[i]);
inc(b[a[i]]);
end;
{———————————-cau-a—————————-}
max:=0;
for i:=1 to n do
if max<b[a[i]] then
begin
max:=b[a[i]];
x:=a[i];
end;
writeln(‘phan tu co so lan xuat hien nhieu nhat trong mang la: ‘,x);
{——————————–cau-b——————————-}
dem:=0;
for i:=1 to n do
if a[i]>=0 then
begin
dem:=dem+1;
c[dem]:=a[i];
end;
dem1:=0;
for i:=1 to dem do
if trunc(sqrt(c[i]))=sqrt(c[i]) then inc(dem1);
writeln(‘so luong so chinh phuong trong day la: ‘,dem1);
{——————————–cau-c—————————–}
dem2:=0;
dem3:=0;
for i:=1 to n do
begin
if a[i]>0 then
begin
inc(dem2);
d[dem2]:=a[i];
end;
if a[i]<0 then
begin
inc(dem3);
e[dem3]:=a[i];
end;
end;
t:=0;
t1:=0;
for i:=1 to dem2 do
t:=t+d[i];
tbcd:=t/dem2;
for i:=1 to dem3 do
t1:=t1+e[i];
tbca:=t1/dem3;
writeln(‘trung binh cong cac so am la: ‘,tbca:4:2);
writeln(‘trung binh cong cac so duong la: ‘,tbcd:4:2);
readln;
end.

Bình luận (0)
Nguyễn Quang Vinh
Xem chi tiết
Trần Bình Nguyên
6 tháng 12 2023 lúc 21:28

bạn học lớp nào ,trường nào thế

Bình luận (0)
Trần Bình Nguyên
6 tháng 12 2023 lúc 21:36

tôi ko biếttttttttttttttttttttttttttttttttttt

 

 

Hahahahahahahahahahaha

Bình luận (0)
DƯƠNG MINH THÁI
6 tháng 12 2023 lúc 23:21

đéo biết

 

Bình luận (0)
Bùi Ngọc Khánh Huyền
Xem chi tiết
Nguyễn Lê Phước Thịnh
6 tháng 8 2023 lúc 17:39

uses crt;

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

i,n,ln:integer;

begin

clrscr;

readln(n);

for i:=1 to n do

readln(a[i]);

ln:=0;

for i:=1 to n do

if trunc(sqrt(A[i]))=sqrt(a[i]) then 

begin

write(a[i]:4);

if ln<A[i] then ln:=A[i];

end;

writeln;

writeln('So chinh phuong lon nhat la: ',ln);

readln;

end.

Bình luận (1)
evilgod709@gmail.com
Xem chi tiết
Nguyễn Lê Phước Thịnh
3 tháng 10 2021 lúc 0:21

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,x,y;
    cout<<"Nhap n="; cin>>n;
    x=n;
    y=n+1;
    if (x%2==0) cout<<x-2<<endl;
    else cout<<x-1<<endl;
    if (y%5==0) cout<<y;
    else {
        while (y%5!=0)
            y++;
        cout<<y;
    }
    return 0;
}

 

Bình luận (0)
Tuoi tom May
Xem chi tiết
Phía sau một cô gái
4 tháng 5 2023 lúc 20:40

program TimMinMaxTrungBinh;

var

      N, i, max, min, sum: integer;

      a: array[1..50] of integer;

      TB, minTB, maxTB: real;

begin

      writeln('Nhap so nguyen duong N:');

      readln(N);

      sum := 0;

      for i := 1 to N do

      begin

            write('Nhap so thu ', i, ': ');

            readln(a[i]);

            sum := sum + a[i];

      end;

      max := a[1];

      min := a[1];

      for i := 2 to N do

      begin

            if a[i] > max then

                  max := a[i];

            if a[i] < min then

                  min := a[i];

      end;

      TB := sum / N;

      minTB := TB;

      maxTB := TB;

      for i := 1 to N do

      begin

            if (a[i] < TB) and (a[i] < minTB) then

                  minTB := a[i];

            if (a[i] > TB) and (a[i] > maxTB) then

                  maxTB := a[i];

      end;

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

      writeln('Gia tri nho nhat la: ', min);

      writeln('Gia tri trung binh la: ', TB:2:2);

      if minTB = TB then

            writeln('Khong co gia tri nao nho hon TB')

      else

            writeln('Gia tri nho nhat < TB la: ', minTB);

      if maxTB = TB then

            writeln('Khong co gia tri nao lon hon TB')

      else

            writeln('Gia tri lon nhat > TB la: ', maxTB);

      readln;

end.

 
  
Bình luận (0)
Indra Sasuke
Xem chi tiết
Quản Gia Lynh
Xem chi tiết
Phía sau một cô gái
20 tháng 4 2023 lúc 21:10

program SoMinMaxTrongMang;

var

     A: array [1..50] of Integer; 

     n, i, min, max: Integer;

begin

     Write('Nhap so phan tu cua mang: ');

     Readln(n);

     for i := 1 to n do

     begin

          Write('A[', i, ']= ');

          Readln(A[i]);

     end;

     min := A[1];

     max := A[1];

     for i := 2 to n do

     begin

          if A[i] < min then

               min := A[i];

          if A[i] > max then

               max := A[i];

     end;

     WriteLn('So lon nhat trong mang la: ', max);

     WriteLn('So nho nhat trong mang la: ', min);

end.

Bình luận (0)