Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int mmc(unsigned int x, unsigned int y){
- int i, mmc;
- mmc = x;
- while(i != 1){
- if(mmc % x == 0 && mmc % y == 0){
- i++;
- return mmc;
- }
- else{
- mmc++;
- }
- }
- }
- int mdc(unsigned int x, unsigned int y){
- int resto;
- while(y != 0){
- resto = x%y;
- x = y;
- y = resto;
- }
- return x;
- }
- int main(int argc, char const *argv[])
- {
- int x;
- int y;
- int c = 0;
- while(c == 0){
- printf("Digite um numero inteiro maior que zero:\n");
- scanf("%d", &x);
- printf("Digite outro numero inteiro maior que zero:\n");
- scanf("%d", &y);
- if(x > 0 && y > 0){
- int k = mdc(x, y);
- int j = mmc(x, y);
- printf("\n\nO MDC e :%d\n\n",k);
- printf("O MMC e :%d\n\n",j);
- c++;
- }
- else{
- printf("\n\nVoce e burro ou idiota? tenta denovo palhaço\n\n");
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement