Advertisement
Guest User

dum kodning lololololololol

a guest
Oct 14th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3.  
  4. int main(void) {
  5. int a, b, i, gcd, small;
  6.  
  7.  
  8. printf("Indtast to positive heltal: ");
  9. scanf("%d %d", &a, &b);
  10.  
  11. small = a <= b ? a : b;
  12.  
  13. while (small > 0) {
  14.  
  15.  
  16. for (i = 1; i <= a && i <= b; ++i) {
  17.  
  18. if (a%i==0 && b%i==0)
  19. gcd = i; }
  20. printf("Den største divisor af %d and %d is %d\n\n", a, b, gcd) ;
  21. printf("Indtast to positive heltal: ");
  22. scanf("%d %d", &a, &b);
  23. }
  24.  
  25. return 0;
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement