+ 2

Help me pls ,it gives out put as zero:-\

friend function https://code.sololearn.com/coWfB7hAwVmg/?ref=app

25th Apr 2019, 1:01 PM
Abhay
Abhay - avatar
21 Answers
+ 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.
25th Apr 2019, 1:47 PM
Sonic
Sonic - avatar
+ 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.
25th Apr 2019, 2:03 PM
Sonic
Sonic - avatar
+ 6
That's much better Abhay 😊.
25th Apr 2019, 2:06 PM
Sonic
Sonic - avatar
+ 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
25th Apr 2019, 1:12 PM
Sonic
Sonic - avatar
+ 2
25th Apr 2019, 1:26 PM
Abhay
Abhay - avatar
+ 2
~ swim ~ sorry lol I just saw it takes 100.0 to give answer in float:-\
25th Apr 2019, 2:03 PM
Abhay
Abhay - avatar
25th Apr 2019, 2:05 PM
Abhay
Abhay - avatar
+ 2
Sonic lol I was confused ,never used 100.0 as denominator
25th Apr 2019, 2:08 PM
Abhay
Abhay - avatar
+ 1
no problems now I passes the same variable as argument in first class ,just changed it and it works well
25th Apr 2019, 1:12 PM
Abhay
Abhay - avatar
+ 1
passed*
25th Apr 2019, 1:13 PM
Abhay
Abhay - avatar
+ 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
25th Apr 2019, 1:14 PM
Abhay
Abhay - avatar
+ 1
~ swim ~ lol I want integer value only
25th Apr 2019, 1:35 PM
Abhay
Abhay - avatar
+ 1
~ swim ~I just wrote it there thinking if by calculations it inputs in decimal ,
25th Apr 2019, 1:42 PM
Abhay
Abhay - avatar
0
now see it inputs in decimal ,hope you are happy now ?
25th Apr 2019, 1:44 PM
Abhay
Abhay - avatar
0
it performed decimal , denominator is right there no need to put decimal to it
25th Apr 2019, 1:49 PM
Abhay
Abhay - avatar