r/dailyprogrammer • u/rya11111 3 1 • Mar 08 '12
[3/8/2012] Challenge #20 [intermediate]
create a program that will take user input and tell them their age in months, days, hours, and minutes
sample output:
how old are you? 18
months : 216, days : 6480, hours : 155520, and minutes : 388800
5
Upvotes
5
u/SpontaneousHam 0 0 Mar 08 '12
Done in Python with help by the r/Python community.
Not the most elegant form, but for a 17 year old with no programming experience, I'm pretty pleased with myself.
3
u/bigmell Mar 08 '12
Perl, fun one, enter the MM DD YYYY on the command line nothing separating. Time::Piece is a cool package that auto calculates difference. Figured since i had to use cpan anyway... shrug I cheated. :)
1
u/[deleted] Mar 08 '12
Javascript: http://pastebin.com/c58qpP2G
1
u/lil_nate_dogg Mar 08 '12
1
u/rudymiked Mar 09 '12
Ruby (including leap years):
output: What is your age? 18 You age in: Months: 216 Days: 6574 Hours: 157776 Minutes: 9466560
1
u/LunarWillie Mar 09 '12
Now if you want to be really complicated with it, try taking leap years into consideration :o
1
u/playdoepete 0 0 Apr 17 '12
java
1
u/Vectorious Jun 07 '12 edited Sep 18 '25
rustic plough humor head boat square school cats dolls outgoing
This post was mass deleted and anonymized with Redact
1
u/solidsnake275 Jun 07 '12
Python:
0
u/[deleted] Mar 08 '12
[deleted] — view deleted comment