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 - 10 years, 8 months ago
reply permalink
keemz - 10 years, 8 months ago
reply permalink
lash - 10 years, 8 months ago
Here is my solution in Java:
reply permalink
lashW - 10 years, 8 months ago
Oh and obviously it should have:
at the top :)
reply permalink
Anonymous - 10 years, 8 months ago
c# ``` var birth = 0; var current = 0;
reply permalink
Emre Ozdemir - 10 years, 8 months ago
reply permalink
Will - 10 years, 8 months ago
Easy-peasy lemon squeezy in LISP!
reply permalink
Pearce Keesling - 10 years, 7 months 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 - 10 years, 7 months ago
reply permalink
rossthebossperot - 10 years, 2 months ago
Some Python
reply permalink
rossthebossperot - 10 years, 2 months ago
And a one liner for good measure
reply permalink