Những câu hỏi liên quan
Thùy Linh Võ
Xem chi tiết
Nguyễn Lê Phước Thịnh
12 tháng 5 2022 lúc 0:09

uses crt;

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

i,n,t,ln,nn:integer;

begin

clrscr;

readln(n);

for i:=1 to n do readln(a[i]);

t:=0;

for i:=1 to n do 

  t:=t+a[i];

writeln(t);

ln:=a[1];

nn:=a[1];

for i:=1 to n do 

begin

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

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

end;

writeln(ln);

writeln(nn);

readln;

end.

Bình luận (0)
HUY HUỲNH QUANG
Xem chi tiết
Kiều Vũ Linh
5 tháng 5 2023 lúc 14:54

Bài 5:

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

i,n,max:integer;

sc, sl:longint;

Begin

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

For i:=1 to n do

Begin

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

If a[i] mod 2 = 0 then sc:=sc+b[i];

If a[i] mod 2 <> 0 then sl:=sl+a[i];

End;

max:=a[1];

For i:=2 to n do

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

Writeln('Tong cac so chan la ',sc);

Writeln('Tong cac so le la ',sl);

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

Readln

End.

Bình luận (1)
Mai Phương Lê
Xem chi tiết
Nguyễn Lê Phước Thịnh
5 tháng 5 2021 lúc 13:14

Bài 1: 

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;

for i:=1 to n do 

  if a[i] mod 2<>0 then write(a[i]:4);

readln;

end.

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

Bài 2: 

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;

for i:=1 to n do

  if a[i] mod 2=0 then write(a[i]:4);

readln;

end.

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

Bài 3: 

uses crt;

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

i,n,t:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

t:=0;

for i:=1 to n do 

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

writeln(t);

readln;

end.

Bình luận (0)
vutransosn
Xem chi tiết
vutransosn
Xem chi tiết
Nguyễn Phúc
Xem chi tiết
Nguyễn Lê Phước Thịnh
19 tháng 5 2021 lúc 9:57

uses crt;

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

i,n,t1,t2,t3:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

t1:=0;

for i:=1 to n do 

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

writeln('Tong cac so am la: ',t1);

t2:=0;

for i:=1 to n do 

  if a[i] mod 2=0 then t2:=t2+a[i];

writeln('Tong cac so chia het cho 2 la: ',t2);

t3:=0;

for i:=1 to n do 

  if (a[i]>0) and (a[i] mod 3=0) then t3:=t3+a[i];

writeln('Tong cac so duong chia het cho 3 la: ',t3);

readln;

end.

Bình luận (0)
erddedfrferf ffvf fd
Xem chi tiết
Nguyễn Lê Phước Thịnh
15 tháng 2 2022 lúc 16:53

#include <bits/stdc++.h>

using namespace std;

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

int main()

{

cin>>n;

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

for (i=1; i<=n; i++) if (a[i]%2!=0) cout<<i<<" ";

cout<<endl;

nn=a[1];

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

cout<<nn<<endl;

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

return 0;

}

Bình luận (2)
Thị Yến Nhi Trịnh
Xem chi tiết
Thị Yến Nhi Trịnh
5 tháng 4 2023 lúc 11:49

E cần câu trl gấp ạk 

Bình luận (0)
Vochehoang
Xem chi tiết
Nguyễn Lê Phước Thịnh
26 tháng 4 2021 lúc 20:04

Câu 1: 

uses crt;

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

i,n:integer;

t:real;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

t:=0;

for i:=1 to n do 

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

writeln(t:4:2);

readln;

end.

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

Câu 2: 

uses crt;

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

i,n:integer;

t:real;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

t:=1;

for i:=1 to n do 

  t:=t*a[i];

writeln(t:4:2);

readln;

end.

Bình luận (0)