Need help in a program..
11
121
1331
14641
can anyone tell the code of this pattern.??
Administrator • Sep 10, 2014
Member • Sep 10, 2014
Member • Sep 10, 2014
First show us what you have done so far?anksingla1
11
121
1331
14641
can anyone tell the code of this pattern.??
Member • Sep 10, 2014
Anoop KumarWhat is next number?? is it 15101051?
Member • Sep 10, 2014
i am using net on my phone...can't show you the code that i tried..Sanyam KhuranaFirst show us what you have done so far?
Member • Sep 10, 2014
No problem, show us the code when you can and then we would help 😀anksinglai am using net on my phone...can't show you the code that i tried..
Administrator • Sep 10, 2014
We are in no hurry. Take your time.anksinglai am using net on my phone...can't show you the code that i tried..
Member • Sep 10, 2014
Member • Sep 10, 2014
Yeah this program is a simple multiplication of 11 but I was asked this in different way..Manish GoyalVery Simple Program,
Simple Loop, and then a single line if you know multiplication
Member • Sep 10, 2014
Anoop KumarWhat is next number?? is it 15101051?
Oops.... next number will be 161051.anksinglaYeah right
Member • Sep 10, 2014
I forgot to mention that question is not multiplication of 11..Anoop KumarOops.... next number will be 161051.
#-Link-Snipped-# , has provided you the right solution. 😉
Member • Sep 10, 2014
Member • Sep 10, 2014
yes...but I didn't got the right code for this.A.V.RamaniOne way of looking at multiplying by 11 is 'Shift and Add'. In effect adding ten times the number to the number.
Put zero in front and at the end of a number that is 0110 for 11. Start adding pairs from the right: 1+0 = 1 which becomes the rightmost digit of the answer. then 1+1 = 2, the second digit and finally 0+1 = 1 the third digit giving the result 121.
This is the method called 'add the neighbour' by Trachtenberg in his teatise on speed mathematics.
Is this what you are getting at?
Member • Sep 11, 2014
Administrator • Sep 11, 2014
Member • Sep 11, 2014
Member • Sep 16, 2014
Wow! 😕pritambuYes because that code is working and giving the correct output.
Member • Sep 17, 2014
Standing ovation for you!pritambuYes because that code is working and giving the correct output.