Skip to content

Instantly share code, notes, and snippets.

@sachin-handiekar
Created October 16, 2011 20:04
Show Gist options
  • Save sachin-handiekar/1291352 to your computer and use it in GitHub Desktop.
Save sachin-handiekar/1291352 to your computer and use it in GitHub Desktop.
10137:The Trip
/*
* 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