+ 2
Help me pls ,it gives out put as zero:-\
friend function https://code.sololearn.com/coWfB7hAwVmg/?ref=app
21 Réponses
+ 6
Abhay I guess there are other ways to improve the code. E.g. it's a bit of overkill to use a class each for principal, interest and time, which are just integers according to what you want. But you will learn this stuff in your programming journey so I am not going to comment too much about it.
+ 6
Abhay if you are the borrower, your argument works for you as you will be able to get away with paying zero interest in some cases 😁.
I prefer to do such calculations with floats and doubles and cast the final answer to an integer if that is what you want.
+ 6
That's much better Abhay 😊.
+ 5
I made a fix here. You were using a lowercase p before as a parameter to principal() and within the function. Also, as S_I is a float I used 100.0 instead of 100 as the divisor in line 38.
https://code.sololearn.com/cU5hly5VUtEr/?ref=app
+ 2
~ swim ~ yup
+ 2
~ swim ~ sorry lol I just saw it takes 100.0 to give answer in float:-\
+ 2
+ 2
Sonic lol I was confused ,never used 100.0 as denominator
+ 1
no problems now I passes the same variable as argument in first class ,just changed it and it works well
+ 1
passed*
+ 1
Sonic ,sorry for any troubles I should have checked my code properly first but it's always good when ppl like you are here to help ,tysm
+ 1
~ swim ~ lol I want integer value only
+ 1
~ swim ~I just wrote it there thinking if by calculations it inputs in decimal ,
0
now see it inputs in decimal ,hope you are happy now ?
0
it performed decimal , denominator is right there no need to put decimal to it