Những câu hỏi liên quan
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)
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)
minh dương
Xem chi tiết
Đỗ Nguyễn Thùy Lâm
Xem chi tiết
Kiều Vũ Linh
5 tháng 5 2023 lúc 8:10

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

i,k:integer;

p:longint;

begin

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

p:=1;

for i:=1 to k do

begin

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

if a[i]<30 then p:=p*a[i];

end;

write('Tich la ',p);

readln

end.

b) 

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

i,k:integer;

s:longint;

begin

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

for i:=1 to k do

begin

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

if a[i]<100 then s:=s+a[i];

end;

write('Tong la ',s);

readln

end.

Bình luận (0)
Vũ Ngọc Lan
Xem chi tiết
Nguyễn Thái Phương Thảo
Xem chi tiết
Tram
Xem chi tiết
Nguyễn Lê Phước Thịnh
9 tháng 3 2023 lúc 14:50

#include <bits/stdc++.h>

using namespace std;

int n,kt,t;

int main()

{

cin>>n;

int t=0;

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

if (i%2==1) cout<<i<<" ";

cout<<endl;

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

{

kt=0;

for (int j=2; j*j<=i; j++)

if (i%j==0) kt=1;

if (kt==0) cout<<i<<" ";

}

return 0;

}

Bình luận (0)
Nguyễn Cảnh Hùng
Xem chi tiết
Đỗ Ngọc Trinh
11 tháng 11 2018 lúc 18:07

Bình luận (0)
Lê Thị Thu Phương
7 tháng 6 2021 lúc 21:04

uses crt;
var a:array[1..1000000] of longint;
      n,i,s:longint;
begin
      clrscr;
      write('Nhap so luong phan tu: '); readln(n);
      for i:=1 to n do 
            begin
                  write('Nhap phan tu thu ',i,': '); readln(a[i]);
                  if a[i] mod 2=1 then inc(s,a[i]);
            end;
      write('Tong cac so le: ',s);
      readln;
end.

Bình luận (0)
Phan Hồng Anh
Xem chi tiết
Đặng Lê Huy Hoàng
17 tháng 5 2022 lúc 16:21

Bình luận (0)
Nguyễn1 cn
17 tháng 5 2022 lúc 16:56

test test

Bình luận (0)