Skip to content

Instantly share code, notes, and snippets.

@leostera
Created August 23, 2011 17:24
Show Gist options
  • Save leostera/1165921 to your computer and use it in GitHub Desktop.
Save leostera/1165921 to your computer and use it in GitHub Desktop.
Problema 40
#include <stdio.h>
int main (int argc, char ** argv)
{
int Rico = 0;
unsigned long long Pobre = 1;
int n = 31;
int i = 0;
int DiaD = -1;
for(;i<n;++i)
{
Rico += 100;
Pobre *= 2;
//printf("Dia #%d -> Rico -> %d\tPobre -> %d\n",i+1,Rico,Pobre);
if(Pobre > Rico && DiaD == -1)
DiaD = i+1;
}
printf("El rico recibio %d sopes y el pobre recibio %ld pesos.\n",Rico,Pobre);
if(DiaD != -1)
printf("A partir de el dia %d el pobre gano mas que el rico",DiaD);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment