+ 1
In this vide i am getting an error.Please correct this
C program on Simple and compound interest https://code.sololearn.com/cP38r62lmqRq/?ref=app
2 Answers
+ 1
#include<stdio.h>
#include<math.h>
int main()
{
int principle,rate,time;
float n,SI;
long int CI;
printf("Enter the value of principle amount:\n"); //(1)
scanf("%d",&principle);
printf("Enter rate value:%d\n",rate);
scanf("%d",&rate);
printf("Enter time:%d\n",time);
scanf("%d",&time);
printf("Enter n value:%f\n",n);
scanf("%f",&n);
SI=(principle*rate*time)/100.0;
printf("simple interest is:%f\n",SI);
CI=principle * pow( (1+(rate/n) ), rate*time) ; //missing * and pow() need 2 arguments
printf("compond interest is:%ld\n",CI);
return 0;
}
/*may farmula need to correct...
2 errors removed, see comments
edit:
Rajulapudi Aswini
actual farmula in correct way is :
CI=principle*pow((1+(rate/n)), rate*time) ;
*/
+ 1
Ok..Thank you