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