Những câu hỏi liên quan
Thủy Tiên
Xem chi tiết
Nguyễn An Ninh
12 tháng 5 2023 lúc 21:28

``python
def UCLN(a, b):
if b == 0:
return a
else:
return UCLN(b, a % b)
a = int(input("Nhập số nguyên a: "))
b = int(input("Nhập số nguyên b: "))
benn = (a * b) // UCLN(a, b)
print("BCNN của", a, "và", b, "là:", bann)

Bình luận (1)
Kiều Vũ Linh
13 tháng 5 2023 lúc 10:34

var a,b,ta,tb,r,bcnn:integer;

begin

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

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

ta:=a;

tb:=b;

repeat

r:=ta mod tb;

ta:=tb;

tb:=r;

until r=0;

bcnn:=a*b/ta;

write('BCNN(',a,' ',b,') la ',bcnn);

readln

end.

Bình luận (0)
Phạm Thị Đông Nhi_HDI
Xem chi tiết
shitbo
21 tháng 6 2020 lúc 16:54

program hello;

uses crt;

Var n,i,j,k: integer;

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

begin;

a[1]:=k;

Readln(n);

For i:=1 to n do

Begin;

Writeln('nhap a[',i,'] '); Readln(a[i]);

End;

For i:=1 to n-1 do

For j:=i+1 to n do

If a[i]<a[j] then k:=a[j];

Writeln('gia tri lon nhat la', k);

end.

Bình luận (0)
 Khách vãng lai đã xóa
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)
Huhu chỉ mình với
Xem chi tiết
Nguyễn Lê Phước Thịnh
8 tháng 11 2021 lúc 23:28

#include <bits/stdc++.h>

using namespace std;

long long a,b;

int main()

{

cin>>a>>b;

cout<<a+b<<endl;

cout<<a-b;

return 0;

}

Bình luận (0)
Ngoc Thanh
Xem chi tiết
Nguyễn Lê Phước Thịnh
5 tháng 12 2021 lúc 13:53

#include <bits/stdc++.h>

using namespace std;

long long a,b;

int main()

{

cin>>a>>b;

if (a<b) cout<<a;

return 0;

}

Bình luận (1)
Sinsin
Xem chi tiết
Nguyễn Lê Phước Thịnh
31 tháng 10 2021 lúc 11:49

#include <bits/stdc++.h>

using namespace std;

long long a,b,s,p;

int main()

{

cin>>a>>b;

s=a+b;

p=a*b;

cout<<"Tong la:"<<s<<endl;

cout<<"Tich la:"<<p;

return 0;

}

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)
Nguyễn Tiến Đạt
Xem chi tiết
Minh Lệ
23 tháng 3 2023 lúc 6:05

Program HOC24;

var a,b: integer;

begin

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

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

if a>b then write(a,' lon hon ',b);

if a<b then write(b,' lon hon ',a);

if a=b then write('Hai so bang nhau');

readln

end.

Bình luận (0)
khonopro
Xem chi tiết
Phía sau một cô gái
6 tháng 3 2023 lúc 20:38

program UocChung;

var

      a, b, i: integer;

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

      n: integer;

begin

      write('Nhap a=');

      readln(a);

      write('Nhap b=');

      readln(b);

      n := 0;

      for i := 1 to 100 do

            if (a mod i = 0) and (b mod i = 0) then

            begin

                  uocchung[n] := i;

                  n := n + 1;

            end;

      write('Uoc chung cua ', a, ' va ', b, ' la: ');

      for i := 0 to n-1 do

             write(uocChung[i], ' ');

      readln;

end.

Bình luận (0)