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.

5 tháng 3 2022

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

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.

 

 

 

 

 

#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

22 tháng 10 2021

uses crt;

var i:integer;

begin

clrscr;

for i:=0 to 9999 do 

  if trunc(sqrt(i))=sqrt(i) then write(i:4);

readln;

end.