#include #include int main() { float fArray[30]; int - TopicsExpress



          

#include #include int main() { float fArray[30]; int choice = 0; int x = 0; float total = 0; float avg = 0; printf(1. Calculate GPA Average); printf(\n2. Enter GPA); printf(\n3. Quit); printf(\n\nEnter your choice (1-3): ); scanf(%d, &choice); if(choice == 2) { printf(\n\nEnter GPA: ); scanf(%.2f\n\n, &fArray[x]); total = total + fArray[x]; } else if(choice == 3) { return 0; } else if(choice == 1) { printf(The average is: %f, total / x); } for(x = 1; x < 30; x++) { fflush(stdin); int temp = 0; printf(1. Calculate GPA Average); printf(\n2. Enter GPA); printf(\n3. Quit); printf(\n\nEnter your choice (1-3): ); scanf(%d, &temp); if(temp == 2) { printf(\n\nEnter GPA: ); scanf(%.2f\n\n, &fArray[x]); } else if(temp == 3) { break; } else if(temp == 1) { printf(The average is: %f, total / x); } } system(pause); }
Posted on: Tue, 04 Mar 2014 07:51:02 +0000

Trending Topics



Recently Viewed Topics




© 2015