C | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

13th Feb 2022, 7:00 PM
Ejeh Wayne
Ejeh Wayne - avatar
3 Answers
+ 1
You're welcome... (Edit: thanks for tag edit)
13th Feb 2022, 7:18 PM
Jayakrishna 🇮🇳
+ 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..
13th Feb 2022, 7:06 PM
Jayakrishna 🇮🇳
+ 2
Jayakrishna🇮🇳 thanks alot,..it really help me ,..thanks
13th Feb 2022, 7:14 PM
Ejeh Wayne
Ejeh Wayne - avatar