i still had the problem for the total course fee..
here's my code:
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void main()
{
int numYears;
double courseFee=10000, totalFee;
double grandFee;
int iii;
char name[40], id[20];
printf("----------------\n");
printf("USER INFORMATION\n\n");
printf("----------------\n");
printf("Enter name:");
gets(name);
printf("Student id:");
gets(id);
printf("\n\nDuration of study(year):");
scanf("%d",&numYears);
printf("\n\n----------------------------------\n");
printf("JAPAN MALAYSIA TECHNICAL INSTITUTE\n");
printf("----------------------------------\n");
printf("\nYear\t\tCourse Fee\n");
for (iii = 1; iii <= numYears; ++iii)
{
if( printf("\n%d\t\tRM%.2f",iii, courseFee) < 0 ) exit (1);
totalFee += courseFee;
courseFee *= 1.05;
grandFee+=courseFee;
}
printf("\n\nTOTAL\n");
printf("-------\n");
printf("Total Course Fee:\nRM%.2lf\n\n",grandFee);
}
Bookmarks
Algorithms and Data Structures
Java tutorials
Algorithms Forum