Your goal for today is to write a program that asks a user for their birth year encoded as two digits (eg "90") and for the current year, also encoded as two digits (eg "14"). The program should then write out the user's age in years. Example input/output:
Year of Birth: 90 Current year: 14 Your age: 24
Comments:
keemz - 12 years, 1 month ago
reply permalink
keemz - 12 years, 1 month ago
reply permalink
lash - 12 years, 1 month ago
Here is my solution in Java:
reply permalink
lashW - 12 years, 1 month ago
Oh and obviously it should have:
at the top :)
reply permalink
Anonymous - 12 years, 1 month ago
c# ``` var birth = 0; var current = 0;
reply permalink
Emre Ozdemir - 12 years, 1 month ago
reply permalink
Will - 12 years, 1 month ago
Easy-peasy lemon squeezy in LISP!
reply permalink
Pearce Keesling - 12 years, 1 month ago
As far as I can tell this is probably the most efficient way to do this (there might be little tweaks, but I mean the general idea). Wrote this up in C++.
reply permalink
brocksrockgym - 12 years, 1 month ago
reply permalink
rossthebossperot - 11 years, 7 months ago
Some Python
reply permalink
rossthebossperot - 11 years, 7 months ago
And a one liner for good measure
reply permalink