/*
amount = starting balance
balance = remaining balance
rate = interest rate per period
rate1 = interest rate per year
payment = monthly payment
principal = payment to principle
interest = payment of interest per period

*******************************************************/
/*		declare variables		*/

	float amount;
	float balance =0;
	float rate1;
	float rate;
	float payment;
	float principal = 0;
	float interest = 0;

/*	**************************	*/
interest1()	/* call compute and print results	*/
{
	
		balance = amount;
		int x =0;

		printf(" payment   interest   principal   balance\n");

	while (balance >0)	/* call compute and print results */
		{
		compute();
		printf("%8.2f  %8.2f  %8.2f    %8.2f   %d\n",payment, interest,
											 principal, balance, ++x);
		line();
		
			if (x%12 ==0)	/* pause every 12 payments  */
				{
				printf("press return");
				getchar();
				}

		}
	
}


/*		compute balance		*/
	compute()
		{

		if (balance > payment)
			{
			interest = balance * rate;
			principal = payment - interest;
			balance = balance - principal;
			return (interest);
			return (principal);
			return (balance);
			}
		else
			{
			interest = balance * rate;
			payment = balance + interest;
			principal = payment - interest;
			balance = balance - principal;
			return (interest);
			return (payment);
			return (principal);
			return (balance);
			}
		}


line()
	{
	int x = 0;
		while (x++<=79)
			printf("-");
		
	}    