// cbai16.cpp : Defines the entry point for the console application.
// code Dung NV
#include"stdafx.h"
#include<stdio.h>
#include<conio.h>
#include<math.h>
intucln(int x, inty)
{
x = abs(x);
y = abs(y);
while(x!=y)
if (x>y) x=x-y; elsey=y-x;
returnx;
}
int_tmain(int argc, _TCHAR* argv[])
{
inta,b,c;
printf("Nhap a: a = "); scanf("%d",&a);
printf("Nhap b: b = "); scanf("%d",&b);
c = ucln(a,b);
printf("Uoc chung lon nhat cua 2 so %d va %d la: %d",a,b,c);
getch();
return0;
}
No comments:
Post a Comment