Những câu hỏi liên quan
Hưng Quốc
Xem chi tiết
HT.Phong (9A5)
31 tháng 3 2023 lúc 16:51

1. Uses crt;

var n,i: integer;

begin clrscr;

readln(n);

for i:=1 to n do write(i:3);

readln;

end.

2. Uses crt;

var n,i: integer;

begin clrscr;

readln(n);

for i:=1 to n do if(i mod 2 = 0) then write(i:3);

readln;

end.

Bình luận (0)
láobốlaos
31 tháng 3 2023 lúc 16:54

1. Uses crt;

var n,i: integer;

begin clrscr;

readln(n);

for i:=1 to n do write(i:3);

readln;

end.

2. Uses crt;

var n,i: integer;

begin clrscr;

readln(n);

for i:=1 to n do if(i mod 2 = 0) then write(i:3);

readln;

end.

Bình luận (0)
Nguyễn Hoàng Duy
2 tháng 4 2023 lúc 16:31

1.

program InDaySoTuNhien;
var n, i: integer;
begin
   write('Nhap so nguyen duong n: ');
   readln(n);

   writeln('Day so tu 1 den ', n, ' la:');
   for i := 1 to n do
      write(i, ' ');
end.

2.

program InSoChan;
var
   n, i: integer;
begin
   write('Nhap so nguyen n: ');
   readln(n);

   writeln('Cac so nguyen chan trong khoang tu 1 den ', n, ' la:');
   for i := 1 to n do
   begin
      if i mod 2 = 0 then
         write(i, ' ');
   end;
end.

Bình luận (0)
Ngáo Ngơ Alice
Xem chi tiết
nguyễn an phát
11 tháng 4 2021 lúc 12:02

program timtich;

uses  crt;

var i,n:integer;

tich:longint;

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

begin

clrscr;

write('nhap so n:');readln(n);

for i:=1 to n do

begin

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

end;

for i:=1 to n do

write(a[i]:4);

tich:=1;

writeln;

for i:=1 to n do

if a[i] mod 2=0 then tich:=tich*a[i];

writeln('tich ca phan tu chan cua mang la:',tich);

readln;

end.

program timtong;

uses  crt;

var i,n:integer;

tong:longint;

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

begin

clrscr;

write('nhap so n:');readln(n);

for i:=1 to n do

begin

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

end;

for i:=1 to n do

write(a[i]:4);

tong:=0;

writeln;

for i:=1 to n do

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

writeln('tong cac phan tu chan cua mang la:',tong);

tong:=0;

writeln;

for i:=1 to n do

if a[i] mod 2=1 then tong:=tong+a[i];

writeln('tong cac phan tu le cua mang la:',tong);

readln;

end.

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

Bài 1: 

uses crt;

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

i,n,s:integer;

begin

clrscr;

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

for i:=1 to n do 

begin

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

end;

s:=1;

for i:=1 to n do 

  if a[i] mod 2=0 then s:=s*a[i];

writeln(s);

readln;

end.

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

uses crt;

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

i,n,t1,t2:integer;

begin

clrscr;

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

for i:=1 to n do 

begin

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

end;

t1:=0;

t2:=0;

for i:=1 to n do

begin

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

else t2:=t2+a[i];

end;

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

writeln('Tong cac so le la: ',t2);

readln;

end.

Bình luận (0)
nguyễn thị như ý
Xem chi tiết
nguyễn an phát
17 tháng 4 2021 lúc 20:09

program in_mang;

uses crt;

var i,n,max:longint;

a:array[1..100]of longint;

begin

clrscr;

write('nhap so n:');readln(n);

for i:=1 to n do

begin

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

end;

writeln('cac phan tu chan:');

for i:=1 to n do

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

writeln;

max:=a[1];

for i:=1 to n do

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

writeln('max cua day la:',max);

readln;

end.

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

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;

for i:=1 to n do 

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

writeln;

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)
Selena Flynn
Xem chi tiết
Nguyễn Lê Phước Thịnh
8 tháng 3 2022 lúc 23:03

c1: 

#include <bits/stdc++.h>

using namespace std;

long long i,n,s;

int main()

{

cin>>n;

s=1;

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

cout<<s;

return 0;

}

Câu 2: 

#include <bits/stdc++.h>

using namespace std;

long long i,n,s;

int main()

{

cin>>n;

s=1;

for (i=1; i<=n; i++) if (i%2==0) s=s*i;

cout<<s;

return 0;

}

Bình luận (0)
Đặng Đức Nam
Xem chi tiết
Kiều Vũ Linh
20 tháng 4 2023 lúc 8:56

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

i,n:integer;

sc,sl:longint;

Begin

Write('Nhap so luong so cua day ');readln(n);

For i:=1 to n do

Begin

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

End;

Write('Tong cac so chan la ');

For i:=1 to n do

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

Writeln(sc);

Write('Tong cac so le la ');

For i:=1 to n do

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

Write(sl);

Readln

End.

Bình luận (0)
AETC丶NhấtㅤGG
Xem chi tiết
Nguyễn Lê Phước Thịnh
10 tháng 5 2022 lúc 23:30

1:

#include <bits/stdc++.h>

using namespace std;

long long n=10, a[10],i,nn;

int main()

{

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

nn=a[1];

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

cout<<nn;

return 0;

}

Bình luận (0)
8/1 Ngọc Hân
Xem chi tiết
Nguyễn Lê Phước Thịnh
30 tháng 4 2022 lúc 22:26

c: 

#include <bits/stdc++.h>

using namespace std;

long long a[1000],n,i;

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<<a[i]<<" ";

return 0;

}

d: 

#include <bits/stdc++.h>

using namespace std;

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

int main()

{

cin>>n;

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

nn=a[1];

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

cout<<nn;

return 0;

}

Bình luận (0)
Bùi duy anh
Xem chi tiết
Minh Lệ
23 tháng 4 2021 lúc 12:49

Program HOC24;

var i,n: integer;

a: array[1..3200] of integer;

begin

write('Nhap gioi han cua day: '); readln(n);

for i:=1 to n do

begin

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

end;

for i:=1 to n do if a[i] mod 2=0 then write(a[i],' ');

readln

end.

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

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 (1)
Nhảy chân sáo mà từ từ đ...
Xem chi tiết
Nguyễn Lê Phước Thịnh
15 tháng 3 2022 lúc 20:38

#include <bits/stdc++.h>

using namespace std;

long long n,i,a[1000],t,dem,t1;

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<<a[i]<<" ";

cout<<endl;

t=0;

dem=0;

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

if (a[i]%2==0)

{

t=t+a[i];

dem++;

}

cout<<fixed<<setprecision(2)<<(t*1.0)/(dem*1.0)<<endl;

t1=0;

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

if (a[i]%2!=0 || a[i]%3==0) t1+=a[i];

cout<<t1;

return 0;

}

Bình luận (0)