Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Grzegorz Zakrzewski program wylicza nwp 2 liczb
- #include<stdio.h>
- int NWP(int p, int q)
- {
- int r = p%q;
- while (r!= 0){
- p = q;
- q = r;
- r = p%q;
- }
- return q;
- }
- int main()
- {
- int p, q, r;
- printf("Podaj p i q\n");
- scanf_s("%d%d", &p, &q);
- r = NWP(p, q);
- printf("NWP wynosi %d\n", r);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement