+ 2
C
#include <stdio.h> #include<math.h> int main() { principal, time; float rate, sim_int, amount, com_int; printf("please enter principal, Time and Rate of interest"); scanf("%d%d%df", &principal,&time,&rate); sim_int = (principal * time * rate/100); printf("\nThe simple Intrest is = %.3f", sim_int); amount=principal*pow((1+rate/100),time); com_int=amount - principal; printf("\nThe Compound Intrest is =%.3f", com_int); return 0; } Someone should help me,..why is my code not printing out the Compound intrest,.,what did I do wrong?🙏 🙏😩 please help me https://code.sololearn.com/cU4JJdT4D5Q9/?ref=app
3 odpowiedzi
+ 1
You're welcome...
(Edit: thanks for tag edit)
+ 3
2 corrections need at :
Line 4 :
principal, time; here
Not have type declarations
int principal, time;
Line 7 :
scanf("%d%d%df", &principal,&time,&rate);
What is %df ? It should be just %f, if you take double type, use %lf
scanf("%d%d%f", &principal,&time,&rate);
edit : Ejeh Wayne
edit Tag to C, its not C# program
hope it helps..
+ 2
Jayakrishna🇮🇳 thanks alot,..it really help me ,..thanks