Guest_imported
New member
- Jan 1, 1970
- 0
I need help with my code in C to be coverted to C++.Please help me.Vianca
# include <stdio.h>
# include <math.h>
# include <stdlib.h>
int main (void)
{
float pricipal,rate,payment;
int term;
char ch;
while (1)
{
puts("Enter The Loan Amount:"
scanf("%f",&principal);
puts("\nEnter The Annual Interest Rate:"
scanf("%f",&rate);
rate /=100;
rate /=12;
puts("Enter the Loan Duration in Months:"
scanf("%d",&term);
payment = (principal * rate) / (1 - pow((1 + rate),- term));
printf("Your monthly Payment will be $%2f.\n",payment);
puts("Do Another(y or n)?"
do
{
ch = getchar();
} while (ch != 'n' && ch != 'y');
if (ch == 'n')
break;
}
return(0);
}
# include <stdio.h>
# include <math.h>
# include <stdlib.h>
int main (void)
{
float pricipal,rate,payment;
int term;
char ch;
while (1)
{
puts("Enter The Loan Amount:"
scanf("%f",&principal);
puts("\nEnter The Annual Interest Rate:"
scanf("%f",&rate);
rate /=100;
rate /=12;
puts("Enter the Loan Duration in Months:"
scanf("%d",&term);
payment = (principal * rate) / (1 - pow((1 + rate),- term));
printf("Your monthly Payment will be $%2f.\n",payment);
puts("Do Another(y or n)?"
do
{
ch = getchar();
} while (ch != 'n' && ch != 'y');
if (ch == 'n')
break;
}
return(0);
}