Skip to content

Commit

Permalink
aventura recursivo
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaeltakano committed Apr 1, 2018
1 parent 31871ad commit 4bbbdd1
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions aventura.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int cont = 0;

int verifica(int pior_caso, int melhor_caso){
int valor;
float aux;
valor = (melhor_caso + pior_caso)/2;
if(valor <= pior_caso-1){
cont++;
return(verifica(valor,melhor_caso));
}
else{
if(pior_caso%2 == 0){
cont++;
}
return(printf("%d\n",cont));
}
}

int main(){
int maximo, minimo, baloes;
minimo = 0;
scanf("%d %d",&maximo,&baloes);
verifica(maximo,minimo);
return(EXIT_SUCCESS);
}

0 comments on commit 4bbbdd1

Please sign in to comment.