Created
October 16, 2011 20:04
-
-
Save sachin-handiekar/1291352 to your computer and use it in GitHub Desktop.
10137:The Trip
This file contains hidden or 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
/* | |
* 10137 The Trip | |
*/ | |
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
int no_of_trips; | |
double sum; | |
double negative_sum; | |
double postive_sum; | |
double avg; | |
double diff; | |
while(scanf("%d", &no_of_trips) != EOF) | |
{ | |
if(no_of_trips == 0) break; | |
double expenses[no_of_trips]; | |
sum = 0; | |
for(int i = 0; | |
i postive_sum) ? -negative_sum : postive_sum; | |
printf("$%.2lf\n", avg); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment