Jump to content

Arrangement of equation

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
noteeth

noteeth

    Newbie

  • Members
  • PipPip
  • 21 posts
hai everybody...
i got a small task to finish n im finish the task already. tq my frend to help me. im juz curious why my equation should be at that place. :confused:

here my code:

#include<stdio.h>


int main()

{

	int duration,year;

	float courseFee, totalFee=0;


	printf("Enter duration of study [year]: ");

	scanf("%d", &duration);


	printf("\nDuration of study: %d", duration);


	printf("\nYear\t\tCourse Fee");

	

	year=1;

	courseFee=10000;

	while (year<=duration)

	{

	

		printf("\n%d\t\t%.2lf", year,courseFee);

		++year;

		totalFee+=courseFee;

		courseFee *= 1.05;

		

	}


		printf("\n\nTotal Course Fees: USD%.2f\n", totalFee); 


	return 0;

}


I already achieve the result of the program.
hope some1 can explain me why im cannot put the equation 'totalFee+=courseFee' below courseFee *= 1.05?

tq. :love:

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Well, I'm guessing you want to add up the fees that were outputted, not 1.05* the fees that were outputted.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
noteeth

noteeth

    Newbie

  • Members
  • PipPip
  • 21 posts
this my result:

[ATTACH]2151[/ATTACH]

Attached Files