Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int x[4];
- int i;
- float C;
- scanf("%d %d %d %d",&x[0],&x[1],&x[2],&x[3]);
- while(x[0]!=0)
- {
- C=0.0;
- for(i=1; C<=x[0] && C>=0; i++)
- {
- C=C+x[1] - 1.0*((i-1)*x[1]*x[3]/100);
- if(C<x[0] && C>=0)
- C=C-x[2];
- }
- if(C<0)
- printf("failure on day %d\n",i-1);
- else
- printf("success on day %d\n",i-1);
- scanf("%d %d %d %d",&x[0],&x[1],&x[2],&x[3]);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement