Bạn chưa đăng nhập. Vui lòng đăng nhập để hỏi bài

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

Bài 1:

uses crt;

var n,i,s:integer;

begin

clrscr;

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

s:=0;

for i:=1 to n do 

 if i mod 6=0 then s:=s+i;

writeln(s);

readln;

end.

Nguyễn Lê Phước Thịnh
5 tháng 5 2021 lúc 20:46

Bài 2: 

uses crt;

var a,b,c,ucln,i:integer;

begin

clrscr;

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

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

write('c='); readln(c);

while a<>b do 

  begin

if a>b then a:=a-b

else b:=b-a;

end;

ucln:=a;

while ucln<>c do 

 begin

if ucln>c then ucln:=ucln-c

else c:=c-ucln;

end;

writeln(ucln);

readln;

end.

Yoriichi_Tsugikuni ( ɻɛɑ...
11 tháng 6 2021 lúc 14:55

Scratch hay java

Khách vãng lai đã xóa
Trần Nguyễn Quỳnh Thy
Xem chi tiết
Hồ Thị Ngọc Vy
Xem chi tiết
HT.Phong (9A5)
10 tháng 4 2023 lúc 14:27

Uses crt;

var max,min,n,i,m,n: longint;

a: array[1..100] of longint

begin clrscr;

for i:=1 to n do begin

if(a[i] mod 2=0) then m:=m+a[i];

if(a[i] mod 2<>0) then n:=n+a[i];

end;

max:=a[1];

min:=a[1];

for i:=1 to n do begin

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

if(min>a[i]) then min:=a[i];

end;

Writeln('Tong cac phan tu chan: ',m);

Writeln('Tong cac phan tu le: ',n);

Writeln('Phan tu co gia tri lon nhat: ',max);

Writeln('Phan tu co gia tri nho nhat: ',min);

readln;

end.

Hồ Thị Ngọc Vy
Xem chi tiết
HT.Phong (9A5)
11 tháng 4 2023 lúc 11:29

Uses crt;

var max,min,n,i,m,n: longint;

a: array[1..100] of longint

begin clrscr;

for i:=1 to n do begin

if(a[i] mod 2=0) then m:=m+a[i];

if(a[i] mod 2<>0) then n:=n+a[i];

end;

max:=a[1];

min:=a[1];

for i:=1 to n do begin

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

if(min>a[i]) then min:=a[i];

end;

Writeln('Tong cac phan tu chan: ',m);

Writeln('Tong cac phan tu le: ',n);

Writeln('Phan tu co gia tri lon nhat: ',max);

Writeln('Phan tu co gia tri nho nhat: ',min);

readln;

end.

Anh Đức 8/8
Xem chi tiết
Nguyễn Lê Phước Thịnh
20 tháng 4 2022 lúc 17:04

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.

Phan Phước Quốc Thịnh
Xem chi tiết
Nguyễn Lê Phước Thịnh
5 tháng 1 2022 lúc 23:03

#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;
}

 

MinhAnh Vũ
Xem chi tiết
Nguyễn Lê Phước Thịnh
5 tháng 5 2021 lúc 23:25

Bài 2:

uses crt;

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

i,n,kt:integer;

begin

clrscr;

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

for i:=1 to n do 

begin

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

end;

kt:=0;

for i:=1 to n-1 do 

 if a[i]>a[i+1] then kt:=1;

if kt=0 then write('Day so khong giam')

else writeln('Day so lon xon');

readln;

end.

Nguyễn Quang
7 tháng 5 2021 lúc 12:16

Đề sai, ko phải lm nx, cô bảo ko thì vào đâu🙂

Mai Xuân Phúc
Xem chi tiết
Bùi Minh Dũng
Xem chi tiết
nguyễn an phát
26 tháng 5 2021 lúc 21:13

program max_min;

uses crt;

var i,n,max,min: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);

writeln;

max:=a[1];min:=a[1];

for i:=1 to n do

begin

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

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

end;

writeln('gia tri lon nhat: ',max,' gia tri nho nhat: ',min);

readln;

end.

Lê Thị Thu Phương
7 tháng 6 2021 lúc 20:59

uses crt;
var a:array[1..1000000] of longint;
      n,i,max,min: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]);
            end;
      write('Day so vua nhap: ');
      for i:=1 to n do write(a[i],' '); writeln;
      max:=a[1];min:=a[1];
      for i:=2 to n do 
            begin
                  if a[i]>max then max:=a[i];
                  if a[i]<min then min:=a[i];
            end;
      writeln('GTLN: ',max);
      writeln('GTNN: ',min);
      readln;
end.