Advertisement
Guest User

Untitled

a guest
Oct 9th, 2015
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. //Grzegorz Zakrzewski program wylicza nwp 2 liczb
  2. #include<stdio.h>
  3.  
  4. int NWP(int p, int q)
  5. {
  6. int r = p%q;
  7. while (r!= 0){
  8. p = q;
  9. q = r;
  10. r = p%q;
  11. }
  12. return q;
  13. }
  14.  
  15. int main()
  16. {
  17. int p, q, r;
  18. printf("Podaj p i q\n");
  19. scanf_s("%d%d", &p, &q);
  20. r = NWP(p, q);
  21. printf("NWP wynosi %d\n", r);
  22. return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement