Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Questão 10
- Desafio 2: Prepare uma função em C que recebe dois inteiros e
- retorna o MDC, máximo divisor comum.
- */
- #include <stdio.h>
- int main(){
- int a,b, resto;
- printf("Digite dois números: ");
- scanf("%d%d",&a,&b);
- resto=a%b;
- for(;resto!=0;){
- a=b;
- b=resto;
- resto=a%b;
- }
- printf("MDC = %d\n",b);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement