Những câu hỏi liên quan
TQ
Xem chi tiết
KL
14 tháng 1 2022 lúc 15:18

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

i,n:integer;

begin

write('Nhap so luong so nguyen trong mang ');readln(n);

for i:=1 to n do

begin

write('nhap phan tu thu ',i,' ');readln(a[i]);

end;

Bình luận (0)
NT
Xem chi tiết
NT
4 tháng 5 2021 lúc 13:17

a) 

uses crt;

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

i,n,max: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];

for i:=1 to n do 

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

writeln(max);

readln;

end.

Bình luận (0)
NT
4 tháng 5 2021 lúc 13:18

b) 

uses crt;

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

i,n,min:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

min:=a[1];

for i:=1 to n do 

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

writeln(min);

readln;

end.

Bình luận (0)
HK
Xem chi tiết
NT
5 tháng 5 2021 lúc 23:25

Bài 1: 

uses crt;

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

i,n,min:integer;

begin

clrscr;

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

for i:=1 to n do 

begin

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

end;

min:=a[1];

for i:=1 to n do 

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

writeln(min);

readln;

end.

Bình luận (1)
NT
5 tháng 5 2021 lúc 23:26

Bài 2: 

uses crt;

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

i,n,max:integer;

begin

clrscr;

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

for i:=1 to n do 

begin

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

end;

max:=a[1];

for i:=1 to n do 

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

writeln(max);

readln;

end.

Bình luận (0)
DH
Xem chi tiết
NT
9 tháng 3 2023 lúc 14:39

#include <bits/stdc++.h>

using namespace std;

int main()

{

int n,k,t=0,x;

cin>>n>>k;

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

{

cin>>x;

if (x%k==0) t=t+x;

}

cout<<t;

return 0;

}

Bình luận (0)
NT
9 tháng 3 2023 lúc 21:20

#include <bits/stdc++.h>

using namespace std;

int main()

{

int n,k,t=0,x;

cin>>n>>k;

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

{

cin>>x;

if (x%k==0) t=t+x;

}

cout<<t;

return 0;

}

Bình luận (0)
TX
Xem chi tiết
PG
24 tháng 3 2023 lúc 20:43

     Đoạn chương trình nhập vào dãy số nguyên gồm N phần tử nhập từ bàn phím

n = int(input("Nhập số phần tử của dãy: "))

a = [ ]

for i in range(n):

     a.append(int(input("Nhập phần tử thứ {0}: ".format(i+1))))

Bình luận (0)
YN
Xem chi tiết
NT
13 tháng 5 2021 lúc 9:38

uses crt;

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

i,n:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

readln;

end.

Bình luận (0)
HN
Xem chi tiết
NT
24 tháng 12 2021 lúc 0:49

#include <bits/stdc++.h>

using namespace std;

long long n,i,a[1000];

int main()

{

cin>>n;

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

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

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

return 0;

}

Bình luận (0)
TN
Xem chi tiết
TG
1 tháng 3 2021 lúc 9:03

Thiếu đề!!

Bình luận (0)
H24
1 tháng 3 2021 lúc 9:03

tham khảo

Bình luận (1)
NT
Xem chi tiết
KL
24 tháng 4 2023 lúc 18:56

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

i,n:integer;

s:longint;

Begin

Write('n = ');readln(n);

For i:=1 to n do

Begin

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

s:=s+a[i];

End;

Write('Cac phan tu vua nhap la ');

For i:=1 to n do

Write(a[i]:8);

Writeln;

Write('Tong cua chung la ',s);

Readln

End.

Bình luận (0)