Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,462 members, 7,819,688 topics. Date: Monday, 06 May 2024 at 09:00 PM

Question For Logical Thinkers - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Question For Logical Thinkers (739 Views)

Logical Math Question / How To Resolve Logical Corruption From Exchange Server? / Programming Required Logical Mind. (2) (3) (4)

(1) (Reply) (Go Down)

Question For Logical Thinkers by Cybergenius(m): 1:47am On Jul 10, 2014
Tom asked his Granny how old she was Rather than giving him a
straight answer,she replied, "i have 6 children, and there are 4
years between each one and the next, i had my first child (Your
uncle peter) When i was 19. Now the youngest one (Your aunty
jane) is 19 herself, Thats all i'm telling you.How old is tom's Granny?
Re: Question For Logical Thinkers by aaidel(m): 2:56am On Jul 10, 2014
58
Re: Question For Logical Thinkers by kibo: 4:28am On Jul 10, 2014
Spot On !!!
aaidel: 58

@OP, BTW when you say 4 years in between each one, it might not necessarily mean 4 years older, for brevity sake.
Re: Question For Logical Thinkers by zicjoe(m): 7:21am On Jul 10, 2014
The ansa is 63
Re: Question For Logical Thinkers by CodeHouse: 8:03am On Jul 10, 2014
Last Child - 19
5th Child - 23
4th Child - 27
3rd Child - 31
2nd Child - 35
1st Child - 39
Granny = 19 + 39 = 58
Re: Question For Logical Thinkers by Nobody: 10:14am On Jul 10, 2014
zz
Re: Question For Logical Thinkers by asalimpo(m): 1:14pm On Jul 10, 2014
// fields
numOfch = 6 //number of children
ageDiff = 4
gAgeFc = 19 //grannie age at first child
ageYcNw = 19 // now age of youngest child.
grannyAgeNow=??//yet 2 b determined
//Functions:

/*cumulative age difference*/

cumAgeDiff(AgeDifference,numOfChildren)
{
return ageDifference*numOfChildren-1
}

/*grannies age after nth child */

gAgeAtNthCh(nthChild,grannyAgeFirstChild)
{
return grannyAgeFirstChild+cumAgeDiff(ageDiff,nthChild)
}

/* grannies age now */

gAgeNow(grannyAgeNthChild, nowAgeNthChild)
{
if(nowAgeNthChild<0)
return -1
return grannyAgeNthChild+nowAgeNthChild
}

//grannys age at 6th child

grannyAgeNow = gAgeNow(gAgeNthCh(6,19), 19)

//or

grannyAgeNow = gAgeNow(gAgeNthCh(numOfCh,gAgeFc), ageYcNw).

//gAgeNow=58

(1) (Reply)

Create Your Own Machine Learning Powered RSS Reader In Under 30 Minutes / To Lean Programming Language What Do I Need To Know First / Cycle-tempo 5.1

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 8
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.