OBEB Kodu
[BILGI]#include <stdio.h>
#include <conio.h>
int obeb(int number1, int number2);
int main()
{
int x, y;
int n = 5;
while (n--) {
printf("iki tamsayı giriniz : ");
scanf("%d%d", &x, &y);
printf("obeb = %d\n", obeb(x, y));
}
getch();
return 0;
}
int obeb(int number1, int number2)
{
int i;
int min = (number1 < number2) ? number1 : number2;
for (i = min; i >= 1; --i)
if (number1 % i == 0 && number2 % i == 0)
return i;
}
[/BILGI]
Okek Kodu
[BILGI]#include <stdio.h>
#include <conio.h>
int okek(int number1, int number2);
int main()
{
int x, y;
int n = 5;
while (n--) {
printf("iki tamsayı giriniz : ");
scanf("%d%d", &x, &y);
printf("okek = %d\n", okek(x, y));
}
getch();
return 0;
}
int okek(int number1, int number2)
{
int i;
int max = (number1 > number2) ? number1 : number2;
for (i = max; i <= number1 * number2; i += max)
if (i % number1 == 0 && i % number2 == 0)
return i;
}
[/BILGI]
Kodlar Hatalıysa Lütfen Bildiriniz..
[BILGI]#include <stdio.h>
#include <conio.h>
int obeb(int number1, int number2);
int main()
{
int x, y;
int n = 5;
while (n--) {
printf("iki tamsayı giriniz : ");
scanf("%d%d", &x, &y);
printf("obeb = %d\n", obeb(x, y));
}
getch();
return 0;
}
int obeb(int number1, int number2)
{
int i;
int min = (number1 < number2) ? number1 : number2;
for (i = min; i >= 1; --i)
if (number1 % i == 0 && number2 % i == 0)
return i;
}
[/BILGI]
Okek Kodu
[BILGI]#include <stdio.h>
#include <conio.h>
int okek(int number1, int number2);
int main()
{
int x, y;
int n = 5;
while (n--) {
printf("iki tamsayı giriniz : ");
scanf("%d%d", &x, &y);
printf("okek = %d\n", okek(x, y));
}
getch();
return 0;
}
int okek(int number1, int number2)
{
int i;
int max = (number1 > number2) ? number1 : number2;
for (i = max; i <= number1 * number2; i += max)
if (i % number1 == 0 && i % number2 == 0)
return i;
}
[/BILGI]
Kodlar Hatalıysa Lütfen Bildiriniz..