Những câu hỏi liên quan
ThẢo Đùù
Xem chi tiết
ThẢo Đùù
17 tháng 12 2017 lúc 9:57

ai giải giúp e với ạ :( tin 11

Bình luận (0)
ThẢo Đùù
Xem chi tiết
Diễm
Xem chi tiết
Bùi Anh Tuấn
25 tháng 4 2021 lúc 19:48

Bình luận (0)
Nguyễn Lê Phước Thịnh
25 tháng 4 2021 lúc 22:13

uses crt;

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

i,n,max,min,t:integer;

begin

clrscr;

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

for i:=1 to n do

begin

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

end;

for i:=1 to n do 

 write(a[i]:4);

writeln;

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(max);

writeln(min);

readln;

end.

t:=0;

for i:=1 to n do 

 if a[i]<>0 then t:=t+a[i];

writeln(t);

readln;

end.

Bình luận (0)
Hoàng Vlogs
Xem chi tiết
Quốc thuận Lê
Xem chi tiết
Phía sau một cô gái
10 tháng 4 2023 lúc 22:55

program PSMCG;

uses crt;

const N = 5;

type MangA = array[1..N] of integer;

var A: MangA;

     i, max, min, sum: integer;

begin

     for i := 1 to N do

     begin

          write('Nhap phan tu A[', i, ']: ');

          readln(A[i]);

     end;

     writeln('Mang A: ');

     for i := 1 to N do

     begin

          write(A[i], ' ');

     end;

     writeln;

     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;

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

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

     sum := 0;

     for i := 1 to N do

     begin

          sum := sum + A[i];

     end;

     writeln('Tong gia tri trong mang A la: ', sum);

     readln;

end.

Bình luận (0)
Văn Tèo Trần
Xem chi tiết
Nguyễn Hoàng Duy
30 tháng 3 2023 lúc 21:23

program BaiTapMang;

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

begin
  // Nhập số phần tử của mảng
  write('Nhap so phan tu cua mang: ');
  readln(n);

  // Nhập giá trị từng phần tử của mảng
  for i := 1 to n do
  begin
    write('Nhap gia tri phan tu thu ', i, ': ');
    readln(a[i]);
  end;

  // Xuất mảng theo chiều ngang
  writeln('Mang vua nhap la:');
  for i := 1 to n do
    write(a[i], ' ');

  // Tìm giá trị lớn nhất và nhỏ nhất của mảng
  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;
  writeln;
  writeln('Gia tri lon nhat cua mang la: ', max);
  writeln('Gia tri nho nhat cua mang la: ', min);

  // Tính tổng các phần tử âm của mảng
  s:= 0;
  for i := 1 to n do
  begin
    if a[i] < 0 then
      s:= s + a[i];
  end;
  writeln('Tong cac phan tu am cua mang la: ', s);

  readln;
end.

Bình luận (2)
Thọ Lê Đức
Xem chi tiết
Kiều Vũ Linh
28 tháng 4 2023 lúc 16:09

Bài 23

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

i,n:integer;

s,tbc:real;

begin

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

for i:=1 to n do

begin

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

s:=s+a[i];

end;

tbc:=s/n;

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

write('Cac so lon hon gia tri trung binh la: ');

for i:=1 to n do

if a[i] > tbc then write(a[i]:8);

readln

end.

Bình luận (0)
Kiều Vũ Linh
28 tháng 4 2023 lúc 16:12

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

i,n,max:integer;

begin

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

for i:=1 to n do

begin

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

end;

max:=a[1];

for i:=2 to n do

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

for i:=1 to n do

begin

if max=a[i] then write(max,' o vi tri thu ',i);

break;

readln

end.

Bình luận (0)
Phương Vũ Hà
Xem chi tiết
Nguyễn Lê Phước Thịnh
1 tháng 3 2021 lúc 17:19

uses crt;

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

n,i,k,max,min,t:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

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

max:=a[1];

for i:=1 to n do 

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

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

writeln('Vi tri la: ');

for i:=1 to n do 

  if max=a[i] then write(i:4);

writeln;

min:=a[1];

for i:=1 to n do

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

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

writeln('Vi tri la: ');

for i:=1 to n do

if min=a[i] then write(i:4);

writeln;

t:=0;

for i:=1 to n do 

  if i mod 2=0 then t:=t+sqr(a[i]);

writeln('Tong binh phuong cac gia tri o vi tri chan la: ',t);

readln;

end. 

Bình luận (0)
35.Nguyễn Phương thanh
Xem chi tiết
Nguyễn Lê Phước Thịnh
9 tháng 2 2022 lúc 22:49

#include <bits/stdc++.h>

using namespace std;

long long a[150],i,s,n,nn;

int main()

{

cin>>n;

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

s=1;

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

if (a[i] %2!=0 && a[i]%3==0) s=s*a[i];

cout<<s<<endl;

nn=a[1];

for (i=1; i<=n; i++) nn=min(nn,a[i]);

for (i=n; i>=1; i--) 

if (nn==a[i]) 

{

cout<<i<<endl;

break;

}

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

for (i=1; i<=n; i++) cout<<a[i]<<" ";

return 0;

}

Bình luận (0)