[ create a new paste ] login | about

Link: http://codepad.org/NV6SVUvg    [ raw code | output | fork | 1 comment ]

C, pasted on Sep 6:
#include<stdio.h>
#include<conio.h>

int main()
{
	int a, b;
	printf("\nNhap a: ");
	scanf("%d", &a);

	printf("\nNhap b: ");
	scanf("%d", &b);

	printf("\nUCLN cua %d va %d la: ", a, b);
	while(a != b)
	{
		if(a > b)
			a = a - b;
		else
			b = b - a;
	}
	printf("%d", a);
	
	getch();
	return 0;
}


Output:
1
Line 17: error: conio.h: No such file or directory


Create a new paste based on this one


Comments:
posted by truc_KHTN18 on Sep 18
#include<stdio.h>
#include<conio.h>

int main()
{
int a, b, min,i,j;
printf("nhap lan luot 2 so khac nhau :\n");
scanf_s("%d%d", &a, &b);

min = a;
if (b < min) min = b;
for (i = 1; i < min; i++)

{
if (a % i == 0 && b%i == 0)
j = i;

}
printf("UCLN cua %d va %d la %d", a, b, j);

_getch();
return 0;
}
reply