TCS
Company
Find the last non zero digit of 96!
a) 2
b) 4
c) 6
d) 8
Read Solution (Total 7)
-
- by my frnd ammir soln
The Algorithm for finding this is :
Lets say D(N) denotes the last non zero digit of factorial, then the algo says
D(N)=4*D[N/5]*D(Unit digit of N)[If tens digit of N is odd]
D(N)=6*D[N/5]*D(Unit digit of N)[If tens digit of N is even]; Where [N/5] is greatest Integer Function (floor)
Also,
D(1)=1 D(2)=2 D(3)=6 D(4)=4 D(5)=2 D(6)=2 D(7)=4 D(8)=2 D(9)=8
D(96)
= 4*D[96/5]*D(6)
= 4*D(19)*D(6)
=4*{4*D(19/5)*D(9)}*D(6)
4*{4*D(3)*8}*2
4*4*6*8*2
1536
so last digit is 6 - 12 years agoHelpfull: Yes(14) No(0)
- The Algorithm for finding this is :
Lets say D(N) denotes the last non zero digit of factorial, then the algo says
D(N)=4*D[N/5]*D(Unit digit of N)[If tens digit of N is odd]
D(N)=6*D[N/5]*D(Unit digit of N)[If tens digit of N is even]; Where [N/5] is greatest Integer Function (floor)
Also,
D(1)=1 D(2)=2 D(3)=6 D(4)=4 D(5)=2 D(6)=2 D(7)=4 D(8)=2 D(9)=8
D(96)
= 4*D[96/5]*D(6)
= 4*D(19)*D(6)
= 4*(4*D[19/5]*D(9))*2
= 4*(4*D(3))*2
= 4*4*6*2
= 192
Ans = 2 - 12 years agoHelpfull: Yes(10) No(7)
- 4*d(96/5)*d(6)
4*d(19)*d(6)
4*2*2 = 16=6
last non zero digit of 96! is 6
> - 12 years agoHelpfull: Yes(6) No(3)
- aamir u don't write the value of d(9) at last step when u put it the last non zero digit is 6
- 12 years agoHelpfull: Yes(6) No(0)
- from calculating 1 to 91 we have 1,11,21,31,,,,,91 multiply their last digits u will get 1
from calculating 2 to 92 we have 2,,12,22,32,,,,,92 multiply their last digits u will get (2)^10=2048=last digit=8
from calculating 3 to 93 we have 3,13,23,33,,,,,93 multiply their last digits u will get (3)^10=177147=last digit=7
from 4,14,,,,,,,,,94 last digit is=4
from 5,15,25,,,,,,95 last digit is=5
from 6,16,26,,,,,,96 last digit is=6
but now in 7,17,27,,,,,,87 last digit is in (7)^9=282475249=9
for the series of 8 last digit=4
for the series of 9 lastdigit is=1
now multiply all the last digits i;e
1*8*7*4*5*6*9*4*1=241920
thus last digit is 2...
- 12 years agoHelpfull: Yes(5) No(6)
- guys see
96!=96*95*94..........
since if we multiply last digits of 96 and 95 i.e 6*5=30 we got 0 in end similarly 95*94 i.e 5*4=20 we got 0 in end now if we multiply 94*93 i.e 4*3=12 last digit is 2 so it is last non zero digit. so answer is 2 - 11 years agoHelpfull: Yes(2) No(0)
- i cant understand it gaurav. plz explain
- 12 years agoHelpfull: Yes(0) No(0)
TCS Other Question