How to get Python Compound Interest Calculator to give the correct answerfinal = P * (((1 + (r/n)) ** (n*t))) TypeError: unsupported operand type(s) for /: 'str' and 'int'How do I copy a file in Python?How can I safely create a nested directory in Python?How do I parse a string to a float or int in Python?How to get the current time in PythonHow can I make a time delay in Python?Getting the last element of a list in PythonHow do I get the number of elements in a list in Python?How do I concatenate two lists in Python?How do I lowercase a string in Python?Interest Calculator In Python
What does chmod -u do?
A social experiment. What is the worst that can happen?
Did arcade monitors have same pixel aspect ratio as TV sets?
lightning-datatable row number error
Loading commands from file
How do you respond to a colleague from another team when they're wrongly expecting that you'll help them?
Why should universal income be universal?
Drawing ramified coverings with tikz
When were female captains banned from Starfleet?
Where does the bonus feat in the cleric starting package come from?
What is the evidence for the "tyranny of the majority problem" in a direct democracy context?
What was the exact wording from Ivanhoe of this advice on how to free yourself from slavery?
Why did the Mercure fail?
Start making guitar arrangements
Why did the EU agree to delay the Brexit deadline?
How could a planet have erratic days?
L1 and Ln cache: when are they written?
Delivering sarcasm
Biological Blimps: Propulsion
The IT department bottlenecks progress. How should I handle this?
What should you do if you miss a job interview (deliberately)?
What is this called? Old film camera viewer?
Should I outline or discovery write my stories?
Why is it that I can sometimes guess the next note?
How to get Python Compound Interest Calculator to give the correct answer
final = P * (((1 + (r/n)) ** (n*t))) TypeError: unsupported operand type(s) for /: 'str' and 'int'How do I copy a file in Python?How can I safely create a nested directory in Python?How do I parse a string to a float or int in Python?How to get the current time in PythonHow can I make a time delay in Python?Getting the last element of a list in PythonHow do I get the number of elements in a list in Python?How do I concatenate two lists in Python?How do I lowercase a string in Python?Interest Calculator In Python
Had posted a question earlier about errors. Thanks to a few people here I was able to fix that issue. Now I've run into the issues of my Compound Interest Calculator giving the wrong calculation when you input the principal, compounded interest (yearly, monthly, etc..), interest rate (0.03, etc...), and the amount of years.
Other Q link: final = P * (((1 + (r/n)) ** (n*t))) TypeError: unsupported operand type(s) for /: 'str' and 'int'
So from the previous code I removed p = 10000, n = 12, r = 0.08 because it would give a large number when you input different numbers. My hope was it would calculate it with the numbers inputted, but it doesn't.
# User must input principal, Compound rate, annual rate, and years.
P = int(input("Enter starting principle please. "))
n = int(input("Enter Compound intrest rate.(daily, monthly, quarterly, half-year, yearly) "))
r = float(input("Enter annual interest amount. (decimal) "))
t = int(input("Enter the amount of years. "))
final = P * (((1 + (r/n)) ** (n*t)))
#displays the final amount after number of years.
print ("The final amount after", t, "years is", final)
# At the moment it is displaying a very random number.
Enter starting principle please. 1000
Enter Compound intrest rate.(daily, monthly, quarterly, half-year, yearly) 1
Enter annual interest amount. (decimal) 0.01
Enter the amount of years. 1
The final amount after 1 years is 1010.0
The final amount should be 1000.10. Not sure what is going on. Trying to see if there is a way to make P, n, r equal the number a user inputs that will result in the correct final answer.
Thanks in advance.
python calculator
add a comment |
Had posted a question earlier about errors. Thanks to a few people here I was able to fix that issue. Now I've run into the issues of my Compound Interest Calculator giving the wrong calculation when you input the principal, compounded interest (yearly, monthly, etc..), interest rate (0.03, etc...), and the amount of years.
Other Q link: final = P * (((1 + (r/n)) ** (n*t))) TypeError: unsupported operand type(s) for /: 'str' and 'int'
So from the previous code I removed p = 10000, n = 12, r = 0.08 because it would give a large number when you input different numbers. My hope was it would calculate it with the numbers inputted, but it doesn't.
# User must input principal, Compound rate, annual rate, and years.
P = int(input("Enter starting principle please. "))
n = int(input("Enter Compound intrest rate.(daily, monthly, quarterly, half-year, yearly) "))
r = float(input("Enter annual interest amount. (decimal) "))
t = int(input("Enter the amount of years. "))
final = P * (((1 + (r/n)) ** (n*t)))
#displays the final amount after number of years.
print ("The final amount after", t, "years is", final)
# At the moment it is displaying a very random number.
Enter starting principle please. 1000
Enter Compound intrest rate.(daily, monthly, quarterly, half-year, yearly) 1
Enter annual interest amount. (decimal) 0.01
Enter the amount of years. 1
The final amount after 1 years is 1010.0
The final amount should be 1000.10. Not sure what is going on. Trying to see if there is a way to make P, n, r equal the number a user inputs that will result in the correct final answer.
Thanks in advance.
python calculator
Why should it be 1000.10? If I understand correctly, yearly compound interest rate 0.01, so 1000*(1.01)^1=1010.0. Am I missing something here?
– Sagar Waghmode
Jan 22 '16 at 17:33
When I run the number through a compound interest calculator to triple check the answer it gives me 1000.10.
– Joshua Gremo
Jan 22 '16 at 17:40
Added an answer. Please check if this is what you want.
– Sagar Waghmode
Jan 22 '16 at 17:42
add a comment |
Had posted a question earlier about errors. Thanks to a few people here I was able to fix that issue. Now I've run into the issues of my Compound Interest Calculator giving the wrong calculation when you input the principal, compounded interest (yearly, monthly, etc..), interest rate (0.03, etc...), and the amount of years.
Other Q link: final = P * (((1 + (r/n)) ** (n*t))) TypeError: unsupported operand type(s) for /: 'str' and 'int'
So from the previous code I removed p = 10000, n = 12, r = 0.08 because it would give a large number when you input different numbers. My hope was it would calculate it with the numbers inputted, but it doesn't.
# User must input principal, Compound rate, annual rate, and years.
P = int(input("Enter starting principle please. "))
n = int(input("Enter Compound intrest rate.(daily, monthly, quarterly, half-year, yearly) "))
r = float(input("Enter annual interest amount. (decimal) "))
t = int(input("Enter the amount of years. "))
final = P * (((1 + (r/n)) ** (n*t)))
#displays the final amount after number of years.
print ("The final amount after", t, "years is", final)
# At the moment it is displaying a very random number.
Enter starting principle please. 1000
Enter Compound intrest rate.(daily, monthly, quarterly, half-year, yearly) 1
Enter annual interest amount. (decimal) 0.01
Enter the amount of years. 1
The final amount after 1 years is 1010.0
The final amount should be 1000.10. Not sure what is going on. Trying to see if there is a way to make P, n, r equal the number a user inputs that will result in the correct final answer.
Thanks in advance.
python calculator
Had posted a question earlier about errors. Thanks to a few people here I was able to fix that issue. Now I've run into the issues of my Compound Interest Calculator giving the wrong calculation when you input the principal, compounded interest (yearly, monthly, etc..), interest rate (0.03, etc...), and the amount of years.
Other Q link: final = P * (((1 + (r/n)) ** (n*t))) TypeError: unsupported operand type(s) for /: 'str' and 'int'
So from the previous code I removed p = 10000, n = 12, r = 0.08 because it would give a large number when you input different numbers. My hope was it would calculate it with the numbers inputted, but it doesn't.
# User must input principal, Compound rate, annual rate, and years.
P = int(input("Enter starting principle please. "))
n = int(input("Enter Compound intrest rate.(daily, monthly, quarterly, half-year, yearly) "))
r = float(input("Enter annual interest amount. (decimal) "))
t = int(input("Enter the amount of years. "))
final = P * (((1 + (r/n)) ** (n*t)))
#displays the final amount after number of years.
print ("The final amount after", t, "years is", final)
# At the moment it is displaying a very random number.
Enter starting principle please. 1000
Enter Compound intrest rate.(daily, monthly, quarterly, half-year, yearly) 1
Enter annual interest amount. (decimal) 0.01
Enter the amount of years. 1
The final amount after 1 years is 1010.0
The final amount should be 1000.10. Not sure what is going on. Trying to see if there is a way to make P, n, r equal the number a user inputs that will result in the correct final answer.
Thanks in advance.
python calculator
python calculator
edited May 23 '17 at 12:31
Community♦
11
11
asked Jan 22 '16 at 17:30
Joshua GremoJoshua Gremo
6115
6115
Why should it be 1000.10? If I understand correctly, yearly compound interest rate 0.01, so 1000*(1.01)^1=1010.0. Am I missing something here?
– Sagar Waghmode
Jan 22 '16 at 17:33
When I run the number through a compound interest calculator to triple check the answer it gives me 1000.10.
– Joshua Gremo
Jan 22 '16 at 17:40
Added an answer. Please check if this is what you want.
– Sagar Waghmode
Jan 22 '16 at 17:42
add a comment |
Why should it be 1000.10? If I understand correctly, yearly compound interest rate 0.01, so 1000*(1.01)^1=1010.0. Am I missing something here?
– Sagar Waghmode
Jan 22 '16 at 17:33
When I run the number through a compound interest calculator to triple check the answer it gives me 1000.10.
– Joshua Gremo
Jan 22 '16 at 17:40
Added an answer. Please check if this is what you want.
– Sagar Waghmode
Jan 22 '16 at 17:42
Why should it be 1000.10? If I understand correctly, yearly compound interest rate 0.01, so 1000*(1.01)^1=1010.0. Am I missing something here?
– Sagar Waghmode
Jan 22 '16 at 17:33
Why should it be 1000.10? If I understand correctly, yearly compound interest rate 0.01, so 1000*(1.01)^1=1010.0. Am I missing something here?
– Sagar Waghmode
Jan 22 '16 at 17:33
When I run the number through a compound interest calculator to triple check the answer it gives me 1000.10.
– Joshua Gremo
Jan 22 '16 at 17:40
When I run the number through a compound interest calculator to triple check the answer it gives me 1000.10.
– Joshua Gremo
Jan 22 '16 at 17:40
Added an answer. Please check if this is what you want.
– Sagar Waghmode
Jan 22 '16 at 17:42
Added an answer. Please check if this is what you want.
– Sagar Waghmode
Jan 22 '16 at 17:42
add a comment |
4 Answers
4
active
oldest
votes
If you are entering interest in percentages, you should take care of that in your code.
final = P * (((1 + (r/(100.0 * n))) ** (n*t)))
Ahhh. didn't even think about that. Thanks, I will run it now and let you know.
– Joshua Gremo
Jan 22 '16 at 17:42
It works! Thank you, been doing these projects since 6am, can't believe I missed that. Appreciate the help @ Sagar
– Joshua Gremo
Jan 22 '16 at 17:44
Welcome. Please accept the answer if it solved your problem. :P
– Sagar Waghmode
Jan 22 '16 at 17:45
add a comment |
Please try the below Python code for Compound Interest:
p = float(input('Please enter principal amount:'))
t = float(input('Please enter number of years:'))
r = float(input('Please enter rate of interest:'))
n = float(input('Please enter number of times the interest is compounded in a year:'))
a = p*(1+(r/(100*n))**(n*t))
print('Amount compounded to: ', a)
add a comment |
Based on this:
Compound Interest Formula
FV = P (1 + r / n)^Yn,
where P is the starting principal, r is the annual interest rate, Y is the number of years invested, and n is the number of compounding periods per year. FV is the future value, meaning the amount the principal grows to after Y years.
P = int(input("Enter starting principle please. "))
n = int(input("Enter number of compounding periods per year. "))
r = float(input("Enter annual interest rate. e.g. 15 for 15% "))
y = int(input("Enter the amount of years. "))
FV = P * (((1 + ((r/100.0)/n)) ** (n*y)))
print ("The final amount after", y, "years is", FV)
add a comment |
P = int(input("Enter starting principle please: "))
n = int(input("Enter number of compounding periods per year: "))
r = float(input("Enter annual interest rate: "))
y = int(input("Enter the amount of years: "))
FV = P * (((1 + ((r/100.0)/n)) ** (n*y)))
print ("The final amount after", y, "years is", FV)
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f34952669%2fhow-to-get-python-compound-interest-calculator-to-give-the-correct-answer%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you are entering interest in percentages, you should take care of that in your code.
final = P * (((1 + (r/(100.0 * n))) ** (n*t)))
Ahhh. didn't even think about that. Thanks, I will run it now and let you know.
– Joshua Gremo
Jan 22 '16 at 17:42
It works! Thank you, been doing these projects since 6am, can't believe I missed that. Appreciate the help @ Sagar
– Joshua Gremo
Jan 22 '16 at 17:44
Welcome. Please accept the answer if it solved your problem. :P
– Sagar Waghmode
Jan 22 '16 at 17:45
add a comment |
If you are entering interest in percentages, you should take care of that in your code.
final = P * (((1 + (r/(100.0 * n))) ** (n*t)))
Ahhh. didn't even think about that. Thanks, I will run it now and let you know.
– Joshua Gremo
Jan 22 '16 at 17:42
It works! Thank you, been doing these projects since 6am, can't believe I missed that. Appreciate the help @ Sagar
– Joshua Gremo
Jan 22 '16 at 17:44
Welcome. Please accept the answer if it solved your problem. :P
– Sagar Waghmode
Jan 22 '16 at 17:45
add a comment |
If you are entering interest in percentages, you should take care of that in your code.
final = P * (((1 + (r/(100.0 * n))) ** (n*t)))
If you are entering interest in percentages, you should take care of that in your code.
final = P * (((1 + (r/(100.0 * n))) ** (n*t)))
answered Jan 22 '16 at 17:39
Sagar WaghmodeSagar Waghmode
632414
632414
Ahhh. didn't even think about that. Thanks, I will run it now and let you know.
– Joshua Gremo
Jan 22 '16 at 17:42
It works! Thank you, been doing these projects since 6am, can't believe I missed that. Appreciate the help @ Sagar
– Joshua Gremo
Jan 22 '16 at 17:44
Welcome. Please accept the answer if it solved your problem. :P
– Sagar Waghmode
Jan 22 '16 at 17:45
add a comment |
Ahhh. didn't even think about that. Thanks, I will run it now and let you know.
– Joshua Gremo
Jan 22 '16 at 17:42
It works! Thank you, been doing these projects since 6am, can't believe I missed that. Appreciate the help @ Sagar
– Joshua Gremo
Jan 22 '16 at 17:44
Welcome. Please accept the answer if it solved your problem. :P
– Sagar Waghmode
Jan 22 '16 at 17:45
Ahhh. didn't even think about that. Thanks, I will run it now and let you know.
– Joshua Gremo
Jan 22 '16 at 17:42
Ahhh. didn't even think about that. Thanks, I will run it now and let you know.
– Joshua Gremo
Jan 22 '16 at 17:42
It works! Thank you, been doing these projects since 6am, can't believe I missed that. Appreciate the help @ Sagar
– Joshua Gremo
Jan 22 '16 at 17:44
It works! Thank you, been doing these projects since 6am, can't believe I missed that. Appreciate the help @ Sagar
– Joshua Gremo
Jan 22 '16 at 17:44
Welcome. Please accept the answer if it solved your problem. :P
– Sagar Waghmode
Jan 22 '16 at 17:45
Welcome. Please accept the answer if it solved your problem. :P
– Sagar Waghmode
Jan 22 '16 at 17:45
add a comment |
Please try the below Python code for Compound Interest:
p = float(input('Please enter principal amount:'))
t = float(input('Please enter number of years:'))
r = float(input('Please enter rate of interest:'))
n = float(input('Please enter number of times the interest is compounded in a year:'))
a = p*(1+(r/(100*n))**(n*t))
print('Amount compounded to: ', a)
add a comment |
Please try the below Python code for Compound Interest:
p = float(input('Please enter principal amount:'))
t = float(input('Please enter number of years:'))
r = float(input('Please enter rate of interest:'))
n = float(input('Please enter number of times the interest is compounded in a year:'))
a = p*(1+(r/(100*n))**(n*t))
print('Amount compounded to: ', a)
add a comment |
Please try the below Python code for Compound Interest:
p = float(input('Please enter principal amount:'))
t = float(input('Please enter number of years:'))
r = float(input('Please enter rate of interest:'))
n = float(input('Please enter number of times the interest is compounded in a year:'))
a = p*(1+(r/(100*n))**(n*t))
print('Amount compounded to: ', a)
Please try the below Python code for Compound Interest:
p = float(input('Please enter principal amount:'))
t = float(input('Please enter number of years:'))
r = float(input('Please enter rate of interest:'))
n = float(input('Please enter number of times the interest is compounded in a year:'))
a = p*(1+(r/(100*n))**(n*t))
print('Amount compounded to: ', a)
edited Mar 8 at 4:30
Pikachu the Purple Wizard
2,02761329
2,02761329
answered Mar 8 at 4:07
Srihari RaoSrihari Rao
112
112
add a comment |
add a comment |
Based on this:
Compound Interest Formula
FV = P (1 + r / n)^Yn,
where P is the starting principal, r is the annual interest rate, Y is the number of years invested, and n is the number of compounding periods per year. FV is the future value, meaning the amount the principal grows to after Y years.
P = int(input("Enter starting principle please. "))
n = int(input("Enter number of compounding periods per year. "))
r = float(input("Enter annual interest rate. e.g. 15 for 15% "))
y = int(input("Enter the amount of years. "))
FV = P * (((1 + ((r/100.0)/n)) ** (n*y)))
print ("The final amount after", y, "years is", FV)
add a comment |
Based on this:
Compound Interest Formula
FV = P (1 + r / n)^Yn,
where P is the starting principal, r is the annual interest rate, Y is the number of years invested, and n is the number of compounding periods per year. FV is the future value, meaning the amount the principal grows to after Y years.
P = int(input("Enter starting principle please. "))
n = int(input("Enter number of compounding periods per year. "))
r = float(input("Enter annual interest rate. e.g. 15 for 15% "))
y = int(input("Enter the amount of years. "))
FV = P * (((1 + ((r/100.0)/n)) ** (n*y)))
print ("The final amount after", y, "years is", FV)
add a comment |
Based on this:
Compound Interest Formula
FV = P (1 + r / n)^Yn,
where P is the starting principal, r is the annual interest rate, Y is the number of years invested, and n is the number of compounding periods per year. FV is the future value, meaning the amount the principal grows to after Y years.
P = int(input("Enter starting principle please. "))
n = int(input("Enter number of compounding periods per year. "))
r = float(input("Enter annual interest rate. e.g. 15 for 15% "))
y = int(input("Enter the amount of years. "))
FV = P * (((1 + ((r/100.0)/n)) ** (n*y)))
print ("The final amount after", y, "years is", FV)
Based on this:
Compound Interest Formula
FV = P (1 + r / n)^Yn,
where P is the starting principal, r is the annual interest rate, Y is the number of years invested, and n is the number of compounding periods per year. FV is the future value, meaning the amount the principal grows to after Y years.
P = int(input("Enter starting principle please. "))
n = int(input("Enter number of compounding periods per year. "))
r = float(input("Enter annual interest rate. e.g. 15 for 15% "))
y = int(input("Enter the amount of years. "))
FV = P * (((1 + ((r/100.0)/n)) ** (n*y)))
print ("The final amount after", y, "years is", FV)
answered Aug 4 '18 at 16:39
Tom KliseTom Klise
1
1
add a comment |
add a comment |
P = int(input("Enter starting principle please: "))
n = int(input("Enter number of compounding periods per year: "))
r = float(input("Enter annual interest rate: "))
y = int(input("Enter the amount of years: "))
FV = P * (((1 + ((r/100.0)/n)) ** (n*y)))
print ("The final amount after", y, "years is", FV)
add a comment |
P = int(input("Enter starting principle please: "))
n = int(input("Enter number of compounding periods per year: "))
r = float(input("Enter annual interest rate: "))
y = int(input("Enter the amount of years: "))
FV = P * (((1 + ((r/100.0)/n)) ** (n*y)))
print ("The final amount after", y, "years is", FV)
add a comment |
P = int(input("Enter starting principle please: "))
n = int(input("Enter number of compounding periods per year: "))
r = float(input("Enter annual interest rate: "))
y = int(input("Enter the amount of years: "))
FV = P * (((1 + ((r/100.0)/n)) ** (n*y)))
print ("The final amount after", y, "years is", FV)
P = int(input("Enter starting principle please: "))
n = int(input("Enter number of compounding periods per year: "))
r = float(input("Enter annual interest rate: "))
y = int(input("Enter the amount of years: "))
FV = P * (((1 + ((r/100.0)/n)) ** (n*y)))
print ("The final amount after", y, "years is", FV)
answered Mar 8 at 22:46
LeqitShxdowLeqitShxdow
31
31
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f34952669%2fhow-to-get-python-compound-interest-calculator-to-give-the-correct-answer%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Why should it be 1000.10? If I understand correctly, yearly compound interest rate 0.01, so 1000*(1.01)^1=1010.0. Am I missing something here?
– Sagar Waghmode
Jan 22 '16 at 17:33
When I run the number through a compound interest calculator to triple check the answer it gives me 1000.10.
– Joshua Gremo
Jan 22 '16 at 17:40
Added an answer. Please check if this is what you want.
– Sagar Waghmode
Jan 22 '16 at 17:42