Những câu hỏi liên quan
Quân
Xem chi tiết
Nguyễn Lê Phước Thịnh
18 tháng 3 2021 lúc 20:14

uses crt;

var a,b:integer;

begin

clrscr;

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

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

if a>b then writeln(a)

else writeln(b);

readln;

end.

Bình luận (0)
An Phạm
Xem chi tiết
Kiều Vũ Linh
28 tháng 4 2023 lúc 16:06

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

i,n,d,max:integer;

begin

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

for i:=1 to n do

begin

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

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

end;

max:=a[1];

for i:=2 to n do

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

writeln('Co ',d,' so le');

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

readln

end.

Bình luận (0)
Yên Trần
Xem chi tiết
Nguyễn Lê Phước Thịnh
30 tháng 12 2021 lúc 15:11

#include <bits/stdc++.h>

using namespace std;

double x;

int main()

{

cin>>x;

if (x>0) cout<<"X la so duong";

else cout<<"X la so am";

return 0;

}

Bình luận (0)
Lý Mạc Sầu
Xem chi tiết
Thanh sang
Xem chi tiết
vhkdhkha
Xem chi tiết
Nguyễn Lê Phước Thịnh
20 tháng 12 2021 lúc 9:43

#include <bits/stdc++.h>

using namespace std;

long long a[1000],i,n;

int main()
{

cin>>n;

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

cin>>a[i];

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

return 0;

}

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)
Phụng Lã
Xem chi tiết
Nguyễn Lê Phước Thịnh
16 tháng 12 2022 lúc 14:42

#include <bits/stdc++.h>

using namespace std;

int A[500],n,i,dem,dem1;

int main()

{

cin>>n;

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

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

cout<<endl;

dem=0;

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

if (A[i]<10) dem++;

cout<<dem<<endl;

dem1=0;

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

if (A[i]>1)

{

bool kt=true;

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

if (A[i]%j==0) kt=false;

if (kt==true) dem1++;

}

cout<<dem1;

return 0;

}

Bình luận (0)
Thảo Linhh
Xem chi tiết
Nguyễn Lê Phước Thịnh
12 tháng 12 2020 lúc 8:04

uses crt;

var a,b:integer;

begin

clrscr;

repeat

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

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

until (a>0) and (b>0);

if a>b then writeln(a,' la so lon hon')

else if a<b then writeln(b,' la so lon hon')

else writeln('Hai so bang nhau');

readln;

end.

Bình luận (0)