Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(void) {
- int a, b, i, gcd, small;
- printf("Indtast to positive heltal: ");
- scanf("%d %d", &a, &b);
- small = a <= b ? a : b;
- while (small > 0) {
- for (i = 1; i <= a && i <= b; ++i) {
- if (a%i==0 && b%i==0)
- gcd = i; }
- printf("Den største divisor af %d and %d is %d\n\n", a, b, gcd) ;
- printf("Indtast to positive heltal: ");
- scanf("%d %d", &a, &b);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement