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.
#include <bits/stdc++.h>
using namespace std;
long long a,b;
//chuongtrinhcon
long long ucln(long long a,long long b)
{
if (b==0) return(a);
else return(ucln(b,a%b));
}
//chuongtrinhchinh
int main()
{
cin>>a>>b;
cout<<ucln(a,b);
return 0;
}
a)
program UCLN_va_BCNN;
uses crt;
var a,b,c,r,p:integer;
begin
clrscr;
write('nhap a,b:');readln(a,b);
if a<b then
begin
c:=a;
a:=b;
b:=c;
end;
p:=a*b;
r:=a mod b;
while r<>0 do
begin
a:=b;
b:=r;
r:=a mod b;
end;
writeln('UCLN la: ',b);
writeln('BCNN la: ',p div b);
readln;
end.
b)
program fibonaci;
uses crt;
var i,n:integer;
a:array[1..30]of integer;
begin
clrscr;
repeat
write('nhap n:');readln(n);
if (n<1)or(n>30) then writeln('so n phai lon hon hoac bang 1 va nho hon hoac bang 30:);
until (n>=1)and(n<=30);
a[1]:=1;
a[2]:=1;
for i:=3 to n do
a[i]:=a[i-1]+a[i-2];
writeln(n,' so fibonaci dau tien la:');
for i:=1 to n do
write(a[i]:3);
readln;
end.
var a,b,i,t,s: word;
begin
repeat
writeln('Nhap A,B vao: (cach nhau boi dau Enter)');
readln(a);
read(b);
writeln('Nhap lai gia tri A,B: ');
until (a>=1) and (b>=1) and (a<=10000) and (b<10000);
s:=a+b;
t:=a*b;
if s<t then i:=s else i:=t;
while (s mod i <> 0) or (t mod i <> 0) do i:=i-1;
writeln('UCLN cua A+B va AB: ',i);
writeln('So du khi chia AB cho A+B: ', t mod s);
end.
#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;
}
uses crt;
var a,b:integer;
begin
clrscr;
readln(a,b);
writeln(a+b);
writeln(a-b);
writeln(a*b);
writeln(a/b:4:2);
readln;
end.