Created
August 23, 2011 17:24
-
-
Save leostera/1165921 to your computer and use it in GitHub Desktop.
Problema 40
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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