K
Khách

Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.

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à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.

3 tháng 5 2023

1)

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

i,n,t:integer;

Begin

Write('n = ');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] > a[i+1] then

Begin

t:=a[i];

a[i]:=a[i+1];

a[i+1]:=t;

End;

Write('Sap xep tang dan ');

For i:=1 to n do write(a[i]:8);

Readln

End.

3 tháng 5 2023

2)

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

i,n,t:integer;

Begin

Write('n = ');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] < a[i+1] then

Begin

t:=a[i];

a[i]:=a[i+1];

a[i+1]:=t;

End;

Write('Sap xep giam dan ');

For i:=1 to n do write(a[i]:8);

Readln

End.

uses crt;

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

i,n,t:integer;

begin

clrscr;

readln(n);

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

t:=0;

for i:=1 to n do 

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

writeln(t);

readln;

end.

5 tháng 5 2023

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.

Câu 1:

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

Câu 2: 

uses crt;

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

i:integer;

begin

clrscr;

for i:=1 to 10 do 

  begin

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

end;

for i:=1 to 10 do 

 write(a[i]:4);

readln;

end.

Câu 3: 

uses crt;

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

i,n,t:integer;

begin

clrscr;

repeat

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

until (0<n) and (n<=15);

for i:=1 to n do 

begin

repeat

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

until a[i]<=100;

end;

writeln('Mang da nhap la: ');

for i:=1 to n do 

  write(a[i]:4);

writeln;

t:=0;

for i:=1 to n do

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

writeln('Tong cac phan tu chia het cho 3 la: ',t);

writeln('Cac so chan o vi tri le trong day la: ');

for i:=1 to n do 

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

readln;

end.

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.

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.

Câu 1: 

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 

  t:=t+a[i];

writeln(t);

readln;

end.

Câu 2: 

uses crt;

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

i,n,x,dem,kt:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

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

end;

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

kt:=0;

dem:=0;

for i:=1 to n do 

if a[i]=x then 

begin

kt:=1;

write(i:4);

inc(dem);

end;

if kt=0 then writeln('Khong co ',x,' trong day');

writeln(x,' xuat hien ',dem,' lan trong day');

readln;

end.

#include <bits/stdc++.h>
using namespace std;
unsigned long long a[50],x,n,uc,i;
//chuongtrinhcon
unsigned long long ucln(long long a,long long b)
{
    if (b==0) return(a);
    else return(ucln(b,a%b));
}
//chuongtrinhchinh
int main()
{
    freopen("ucln.inp","r",stdin);
    freopen("ucln.out","w",stdout);
    cin>>n;

cin>>a[1]>>a[2];

uc=ucln(a[1],a[2]);

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

{

cin>>x;

uc=ucln(uc,x);

}

cout<<uc;
    return 0;
}

 

26 tháng 5 2021

program max_min;

uses crt;

var i,n:integer;

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

begin

clrscr;

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

for i:=1 to n do

begin

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

end;

writeln('day vua nhap la:');

for i:=1 to n do

write(a[i]:3);

readln;

end.