Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int Bruch_Rechnen::ggt(int zahl1, int zahl2)
- {
- int rest = 0;
- do {
- rest = zahl1 % zahl2;
- zahl1 = zahl2;
- zahl2 = rest;
- } while (zahl2 != 0);
- return zahl1;
- }
- int Bruch_Rechnen::kgv(int zahl1, int zahl2)
- {
- int ggT = ggt(zahl1, zahl2);
- return (zahl1 * zahl2) / ggT;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement