Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // achar divisores comuns entre dois números
- #include <stdio.h>
- int main(void)
- {
- int a,b,i,x,y;
- printf("a= ");
- scanf("%d",&a);
- printf("b= ");
- scanf("%d",&b);
- for (i=1;i<=1000;i++)
- {
- x=(a/i)*i;
- y=(b/i)*i;
- if (x==a && y==b)
- printf("%d é divisor de %d e %d.\n",i,a,b);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement