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.

uses crt;

var s,i:integer;

begin

clrscr;

i:=1;

s:=1;

while s<=1000 do 

  begin

i:=i+1;

s:=s*i;

end;

writeln(s);

readln;

end.

4 tháng 5 2023

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.

 
  

uses crt;

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

i,n,max,min:integer;

begin

clrscr;

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

for i:=1 to n do 

 begin

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

end;

max:=a[1];

min:=a[1];

for i:=1 to n do 

begin

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

if min>a[i] then min:=a[i];

end;

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

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

readln;

end.

1:

uses crt;

var t,x,i,n:integer;

begin

clrscr;

t:=0;

n:=10;

for i:=1 to n do

begin

readln(x);

t:=t+x;

end;

write(t);

readln;

end.

2: 

uses crt;

var dem,x,i,n:integer;

begin

clrscr;

dem:=0;

n:=10;

for i:=1 to n do

begin

readln(x);

if x mod 2=0 then inc(dem);

end;

write(dem);

readln;

end.

4 tháng 4 2023

3

program Cacsole;
uses crt;
var M, N, i: integer;
begin
clrscr;
write ('Nhap M= '); readln(M);
write ('Nhap N= '); readln(N);
for i := M to N do

if  i mod 2 = 1 then
write (i,' ');
readln;
end.

20 tháng 4 2022

Var a:array[1..20] of integer;

max,min:integer;

tbc:real;

Begin

For i:=1 to 20 do

Begin

Write('Nhap so thu ',i,' = ');readln(a[i]);

End;

Max:=a[1];

Min:=a[1];

For i:=2 to 20 do

Begin

If a[i] > max then max:=a[i];

If a[i] < min then min:=a[i];

End;

tbc:=(max+min)/2;

Writeln('So lon nhat la ',max);

Writeln('So nho nhat la ',min);

Write('Trung binh cong la ',tbc:10:2);

Readln;

End.

26 tháng 3 2022

uses crt;
var a: array[1..100] of longint;
    i,n,max,min: longint;

begin
    clrscr;
    readln(n);
    for i:=1 to n do
    begin
        write('Nhap so thu ',i,': '); 
        readln(a[i]);
    end;
    max:=a[1]; min:=a[1];
    for i:=1 to n do
    begin
        if max<a[i] then max:=a[i];
        if min>a[i] then min:=a[i];
    end;
    writeln('So lon nhat trong mang la: ',max);
    write('So nho nhat trong mang la: ',min);
    readln
end.

#include <bits/stdc++.h>

using namespace std;

long long a[100],n,i,s,t,ln,nn;

int main()

{

cin>>n;

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

cin>>a[i];

s=1;

t=0;

ln=a[1];

nn=a[1];

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

{

s=s*a[i];

t+=a[i];

ln=max(ln,a[i]);

nn=min(nn,a[i]);

}

cout<<s<<endl;

cout<<t<<endl;

cout<<ln<<endl;

cout<<nn;

return 0;

}

#include <bits/stdc++.h>

using namespace std;

long long t1,t2,i;

int main()

{

t1=0;

t2=0;

for (i=15; i<=1000; i++)

{

t1+=i;

t2-=i;

}

cout<<t1<<" "<<t2;

return 0;

}

28 tháng 4 2021

Program HOC24;

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

i,max,min,n: integer;

begin

write('Nhap so phan tu N: '); readln(N);

for i:=1 to n do

begin

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

end;

max:=a[1]; min:=a[1];

for i:=1 to n do

begin

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

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

end;

writeln('So nho nhat la :',max);

write('So lon nhat la: ',min);

readln

end.

uses crt;

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

i,n,max,min:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

max:=a[1];

min:=a[1];

for i:=1 to n do 

  begin

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

if min>a[i] then min:=a[i];

end;

writeln('So lon nhat la: ',max);

writeln('So nho nhat la: ',min);

readln;

end.

Câu 4: 

uses crt;

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

i,n,dem,t:integer;

begin

clrscr;

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

for i:=1 to n do 

 begin

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

end;

dem:=0;

t:=0;

for i:=1 to n do 

  if (10<a[i]) and (a[i]<20) then 

begin

inc(dem);

t:=t+a[i];

end;

writeln('So phan tu lon hon 10 va nho hon 20 la: ',dem);

writeln('Tong cac phan tu lon hon 10 va nho hon 20 la: ',t);

readln;

end.

Câu 5:

uses crt;

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

i,n,dem,t:integer;

begin

clrscr;

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

for i:=1 to n do 

 begin

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

end;

dem:=0;

t:=0;

for i:=1 to n do 

 if a[i] mod 2=0 then 

begin

inc(dem);

t:=t+a[i];

end;

writeln('So so chan la: ',dem);

writeln('Tong cac so chan la: ',t);

readln;

end.