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.

uses crt;

var a,b,x,y:integer;

//chuongtrinhcon

function ucln(var a,b:integer):integer;

var r:integer;

begin

while b>0 do

begin

r:=a mod b;

a:=b;

b:=r;

end;

ucln:=a;

end;

//chuongtrinhchinh

begin

clrscr;

readln(a,b);

x:=a;

y:=b;

if (x>0) and (y>0) then writeln(x div ucln(a,b),' ',y div ucln(a,b));

if (x<0) and (y<0) then 

begin

x:=abs(x);

y:=abs(y);

a:=abs(a);

b:=abs(b);

writeln(x div ucln(a,b),' ',y div ucln(a,b));

end; 

if (x<0) and (y>0) then 

begin

write('-');

x:=abs(x);

y:=abs(y);

a:=abs(a);

b:=abs(b);

writeln(x div ucln(a,b),' ',y div ucln(a,b));

end;

if (x>0) and (y<0) then 

begin

write('-');

x:=abs(x);

y:=abs(y);

a:=abs(a);

b:=abs(b);

writeln(x div ucln(a,b),' ',y div ucln(a,b));

end;

readln;

end.

uses crt;

var a,b,x,y:integer;

//chuongtrinhcon

function ucln(var a,b:integer):integer;

var r:integer;

begin

while b>0 do

begin

r:=a mod b;

a:=b;

b:=r;

end;

ucln:=a;

end;

//chuongtrinhchinh

begin

clrscr;

readln(a,b);

x:=a;

y:=b;

if (x>0) and (y>0) then writeln(x div ucln(a,b),' ',y div ucln(a,b));

if (x<0) and (y<0) then 

begin

x:=abs(x);

y:=abs(y);

a:=abs(a);

b:=abs(b);

writeln(x div ucln(a,b),' ',y div ucln(a,b));

end; 

if (x<0) and (y>0) then 

begin

write('-');

x:=abs(x);

y:=abs(y);

a:=abs(a);

b:=abs(b);

writeln(x div ucln(a,b),' ',y div ucln(a,b));

end;

if (x>0) and (y<0) then 

begin

write('-');

x:=abs(x);

y:=abs(y);

a:=abs(a);

b:=abs(b);

writeln(x div ucln(a,b),' ',y div ucln(a,b));

end;

readln;

end.

uses crt;

var a,b,x,y:integer;

//chuongtrinhcon

function ucln(var a,b:integer):integer;

var r:integer;

begin

while b>0 do

begin

r:=a mod b;

a:=b;

b:=r;

end;

ucln:=a;

end;

//chuongtrinhchinh

begin

clrscr;

readln(a,b);

x:=a;

y:=b;

if (x>0) and (y>0) then writeln(x div ucln(a,b),' ',y div ucln(a,b));

if (x<0) and (y<0) then 

begin

x:=abs(x);

y:=abs(y);

a:=abs(a);

b:=abs(b);

writeln(x div ucln(a,b),' ',y div ucln(a,b));

end; 

if (x<0) and (y>0) then 

begin

write('-');

x:=abs(x);

y:=abs(y);

a:=abs(a);

b:=abs(b);

writeln(x div ucln(a,b),' ',y div ucln(a,b));

end;

if (x>0) and (y<0) then 

begin

write('-');

x:=abs(x);

y:=abs(y);

a:=abs(a);

b:=abs(b);

writeln(x div ucln(a,b),' ',y div ucln(a,b));

end;

readln;

end.

uses crt;

var a,b,x,y:integer;

//chuongtrinhcon

function ucln(var a,b:integer):integer;

var r:integer;

begin

while b>0 do

begin

r:=a mod b;

a:=b;

b:=r;

end;

ucln:=a;

end;

//chuongtrinhchinh

begin

clrscr;

readln(a,b);

x:=a;

y:=b;

if (x>0) and (y>0) then writeln(x div ucln(a,b),' ',y div ucln(a,b));

if (x<0) and (y<0) then 

begin

x:=abs(x);

y:=abs(y);

a:=abs(a);

b:=abs(b);

writeln(x div ucln(a,b),' ',y div ucln(a,b));

end; 

if (x<0) and (y>0) then 

begin

write('-');

x:=abs(x);

y:=abs(y);

a:=abs(a);

b:=abs(b);

writeln(x div ucln(a,b),' ',y div ucln(a,b));

end;

if (x>0) and (y<0) then 

begin

write('-');

x:=abs(x);

y:=abs(y);

a:=abs(a);

b:=abs(b);

writeln(x div ucln(a,b),' ',y div ucln(a,b));

end;

readln;

end.

uses crt;

var a,b,x,y:integer;

//chuongtrinhcon

function ucln(var a,b:integer):integer;

var r:integer;

begin

while b>0 do

begin

r:=a mod b;

a:=b;

b:=r;

end;

ucln:=a;

end;

//chuongtrinhchinh

begin

clrscr;

readln(a,b);

x:=a;

y:=b;

if (x>0) and (y>0) then writeln(x div ucln(a,b),' ',y div ucln(a,b));

if (x<0) and (y<0) then 

begin

x:=abs(x);

y:=abs(y);

a:=abs(a);

b:=abs(b);

writeln(x div ucln(a,b),' ',y div ucln(a,b));

end; 

if (x<0) and (y>0) then 

begin

write('-');

x:=abs(x);

y:=abs(y);

a:=abs(a);

b:=abs(b);

writeln(x div ucln(a,b),' ',y div ucln(a,b));

end;

if (x>0) and (y<0) then 

begin

write('-');

x:=abs(x);

y:=abs(y);

a:=abs(a);

b:=abs(b);

writeln(x div ucln(a,b),' ',y div ucln(a,b));

end;

readln;

end.

uses crt;

var a,b,x,y:integer;

//chuongtrinhcon

function ucln(var a,b:integer):integer;

var r:integer;

begin

while b>0 do

begin

r:=a mod b;

a:=b;

b:=r;

end;

ucln:=a;

end;

//chuongtrinhchinh

begin

clrscr;

readln(a,b);

x:=a;

y:=b;

if (x>0) and (y>0) then writeln(x div ucln(a,b),' ',y div ucln(a,b));

if (x<0) and (y<0) then 

begin

x:=abs(x);

y:=abs(y);

a:=abs(a);

b:=abs(b);

writeln(x div ucln(a,b),' ',y div ucln(a,b));

end; 

if (x<0) and (y>0) then 

begin

write('-');

x:=abs(x);

y:=abs(y);

a:=abs(a);

b:=abs(b);

writeln(x div ucln(a,b),' ',y div ucln(a,b));

end;

if (x>0) and (y<0) then 

begin

write('-');

x:=abs(x);

y:=abs(y);

a:=abs(a);

b:=abs(b);

writeln(x div ucln(a,b),' ',y div ucln(a,b));

end;

readln;

end.

5 tháng 3 2022

Dạ pascal được không ạ, 

 

 

 

 

 

#include <bits/stdc++.h>
using namespace std;
long long a,b;
//chuongtrinhcon
long long gcd(long long a,long long b)
{
    if (b==0) return(a);
    return gcd(b,a%b);
}
//chuongtrinhchinh
int main()
{
    cin>>a>>b;
    if ((a>0 && b>0) or (a<0 && b<0)) cout<<a/gcd(a,b)<<" "<<b/gcd(a,b);
    else cout<<"-"<<-a/gcd(-a,b)<<" "<<b/gcd(-a,b);
    return 0;
}

 

6 tháng 3 2022

lỗi r

6 tháng 3 2022

lỗi