How to get the last non zero number is the factorial of a given no. The given no. can have many digits even more than 100? I have to solve this problem in c++ using STL....

This is a common starter challenge in college and high school programming classes. While i'm not willing to code it for you, I can show you the methods you'll need to understand in order to approach the problem. The easiest way of doing this is by using a brute force method. Just keep testing the number to see if the remainder after dividing it with a number lower than it is zero. If so, it's a factor.

For example, If the number is 35 then pick a number just one lower than it that's not the number 1. Now divide the two numbers. 35/34 = a number with many decimal places after it, which means its not one of the factors of the number. However, eventually, you'll approach the number 7, and 35/7 = 5. This number has no decimal, meaning it IS a factor of 35, and also the largest non-zero factor of 35. Your algorithm can now stop, since it found the largest non-zero number.

Here's some pseudo-code:

int largestfactor(int number) {

int temp = number;

for(temp - 1; temp>=1; temp--) {

if (number % temp == 0) return temp

}

return temp

}

Something like that, with some bug tweaks will do it. The "%" sign is called a modulus. It's a standard c++ operator. Good luck, and remember to vote Fixya if you liked it.

The wikipedia article that helps you with better and more effecient algorithms can be found here.

Steven

Posted on Sep 17, 2008

Hi,

a 6ya expert can help you resolve that issue over the phone in a minute or two.

best thing about this new service is that you are never placed on hold and get to talk to real repairmen in the US.

the service is completely free and covers almost anything you can think of (from cars to computers, handyman, and even drones).

click here to download the app (for users in the US for now) and get all the help you need.

goodluck!

Posted on Jan 02, 2017

The TI-84 is limited to numbers with at most twelve significant digits.

If you must know the EXACT value of 16!, try this. Calculate 14!. Note the two zeroes at the end. Strip them off by dividing by 100 and remember the two zeroes. Multiply by 15. Strip off the last zero by dividing by 10 and remember that we've now stripped off three zeroes. Multiply by 16. Add the three zeroes at the end to get a fourteen-digit number.

In this particular case the result is exactly what you get by using the FACT function. That's also true for 17!, but it breaks down past that because 18! has more than twelve significant digits.

The whole point of the calculator is to allow you to do calculations with a reasonable degree of accuracy, as opposed to exactly. You'll notice that it can't do a simple operation like dividing 1 by 3 and produce an EXACT answer---only a twelve-digit approximation.

If you must know the EXACT value of 16!, try this. Calculate 14!. Note the two zeroes at the end. Strip them off by dividing by 100 and remember the two zeroes. Multiply by 15. Strip off the last zero by dividing by 10 and remember that we've now stripped off three zeroes. Multiply by 16. Add the three zeroes at the end to get a fourteen-digit number.

In this particular case the result is exactly what you get by using the FACT function. That's also true for 17!, but it breaks down past that because 18! has more than twelve significant digits.

The whole point of the calculator is to allow you to do calculations with a reasonable degree of accuracy, as opposed to exactly. You'll notice that it can't do a simple operation like dividing 1 by 3 and produce an EXACT answer---only a twelve-digit approximation.

Oct 03, 2012 | Texas Instruments TI84Plus Graphic...

Let me give you a general recipe to familiarize yourself with any calculator, if you are averse to reading the manuals.

Most function will work in one of two ways.

1st way

Enter the number, then press the key,; the result is displayed.immediately.

Second way

Press the function key ( a left parenthesis may be displayed) enter the number (close the right parenthesis if there was a left one) press the = or EXE or ENTER keys.

Try the two ways described above to calculate the following values. The answers are given. Here log is he decimal logarithm and ln is the natural logarithm.

log(1)=0

ln(1)=0

ln(2)=0.693147181

log(2)=0.301029996

ln(100)=4.605170186

log(10)=1 (= number of zeros after the 1)

log(100)=2. (= number of zeros after the 1)

log(1000)=3 (number of zeros after the 1)

log(10000)=4 (number of zeros after the 1)

Most function will work in one of two ways.

1st way

Enter the number, then press the key,; the result is displayed.immediately.

Second way

Press the function key ( a left parenthesis may be displayed) enter the number (close the right parenthesis if there was a left one) press the = or EXE or ENTER keys.

Try the two ways described above to calculate the following values. The answers are given. Here log is he decimal logarithm and ln is the natural logarithm.

log(1)=0

ln(1)=0

ln(2)=0.693147181

log(2)=0.301029996

ln(100)=4.605170186

log(10)=1 (= number of zeros after the 1)

log(100)=2. (= number of zeros after the 1)

log(1000)=3 (number of zeros after the 1)

log(10000)=4 (number of zeros after the 1)

Aug 17, 2011 | Texas Instruments TI-30 XIIS Calculator

Since you left open the choice of language, I chose to do this in RPL.

{{ ! }}

where {{ and }} represent the double-arrow program delimiters.

Given 30, this program returns 265252859812191058636308480000000 (assuming I types it correctly).

{{ ! }}

where {{ and }} represent the double-arrow program delimiters.

Given 30, this program returns 265252859812191058636308480000000 (assuming I types it correctly).

Feb 15, 2011 | Lands Phones

sir please call to the related simcard customercare and say the last 6-digit number which is present before the simcard. then they will give the pukcode number to unlock the cellphone...........

Dec 31, 2010 | LG Cell Phones

3 Digit Combination Lock

31-10-31

3 Digit Combination Locks for Security Safes

31-10-31

3 Digit Combination Locks for Gun Safes

31-10-31

Electronic Locks

31-10-31

4 Digit Combination Lock

31-10-31-10

31-10-31

- NOTE: If your safe DOES NOT have a key, skip Step 3.

- Turn the dial to zero.

- Insert your key and turn it until the plunger pops out.

- Turn the dial to the left (counterclockwise) three times to the first number of the combination (pass the first number of your combination two times, stopping on it the third time).

- Turn the dial to the right (clockwise) two times to the second number of the combination (pass your second number once, stopping on it the second time).

- Turn the dial to the left to the last number (stop the first time on your last number).

Pull the handle down; the door should open.

3 Digit Combination Locks for Security Safes

31-10-31

- Turn the dial to zero.

- Turn the dial to the left (counterclockwise) three times to the first number of the combination (pass the first number of your combination two times, stopping on it the third time).

- Turn the dial to the right (clockwise) two times to the second number of the combination (pass your second number once, stopping on it the second time).

- Turn the dial to the left to the last number (stop the first time on your last number).

- Insert the key; turn right.

Pull on the key while it's in the lock to open the door.

3 Digit Combination Locks for Gun Safes

31-10-31

- Turn the dial to zero.

- Turn the dial to the left (counterclockwise) three times to the first number of the combination (pass the first number of your combination two times, stopping on it the third time).

- Turn the dial to the right (clockwise) two times to the second number of the combination (pass your second number once, stopping on it the second time).

- Turn the dial to the left to the last number (stop the first time on your last number).

Pull the handle down; the door should open.

Electronic Locks

31-10-31

- Insert the tubular key into the lock to the left of the key pad.

- Turn the key all the way to the right until the plunger pops out.

- Press the five-digit factory code. The green Proceed light will come on.

- Pull the handle down; the door should open.

4 Digit Combination Lock

31-10-31-10

- Turn the dial to zero.

- Turn the dial to the left (counterclockwise) four times to the first number of the combination (pass the first number of your combination three times, stopping on it the fourth time).

- Turn the dial to the right (clockwise) three times to the second number of the combination (pass your second number twice, stopping on it the third time).

- Turn the dial to the left (counterclockwise) two times to the third number of the combination (pass the third number of your combination one time, stopping on it the second time).

- Turn the dial to the right to the last number (stop the first time on your last number).

- Pull the handle down; the door should open.

Dec 11, 2010 | Sentry Fireproof Safe

3 Digit Combination Lock

31-10-31

3 Digit Combination Locks for Security Safes

31-10-31

3 Digit Combination Locks for Gun Safes

31-10-31

Electronic Locks

31-10-31

4 Digit Combination Lock

31-10-31-10

31-10-31

- NOTE: If your safe DOES NOT have a key, skip Step 3.

- Turn the dial to zero.

- Insert your key and turn it until the plunger pops out.

- Turn the dial to the left (counterclockwise) three times to the first number of the combination (pass the first number of your combination two times, stopping on it the third time).

- Turn the dial to the right (clockwise) two times to the second number of the combination (pass your second number once, stopping on it the second time).

- Turn the dial to the left to the last number (stop the first time on your last number).

Pull the handle down; the door should open.

3 Digit Combination Locks for Security Safes

31-10-31

- Turn the dial to zero.

- Turn the dial to the left (counterclockwise) three times to the first number of the combination (pass the first number of your combination two times, stopping on it the third time).

- Turn the dial to the right (clockwise) two times to the second number of the combination (pass your second number once, stopping on it the second time).

- Turn the dial to the left to the last number (stop the first time on your last number).

- Insert the key; turn right.

Pull on the key while it's in the lock to open the door.

3 Digit Combination Locks for Gun Safes

31-10-31

- Turn the dial to zero.

- Turn the dial to the left (counterclockwise) three times to the first number of the combination (pass the first number of your combination two times, stopping on it the third time).

- Turn the dial to the right (clockwise) two times to the second number of the combination (pass your second number once, stopping on it the second time).

- Turn the dial to the left to the last number (stop the first time on your last number).

Pull the handle down; the door should open.

Electronic Locks

31-10-31

- Insert the tubular key into the lock to the left of the key pad.

- Turn the key all the way to the right until the plunger pops out.

- Press the five-digit factory code. The green Proceed light will come on.

- Pull the handle down; the door should open.

4 Digit Combination Lock

31-10-31-10

- Turn the dial to zero.

- Turn the dial to the left (counterclockwise) four times to the first number of the combination (pass the first number of your combination three times, stopping on it the fourth time).

- Turn the dial to the right (clockwise) three times to the second number of the combination (pass your second number twice, stopping on it the third time).

- Turn the dial to the left (counterclockwise) two times to the third number of the combination (pass the third number of your combination one time, stopping on it the second time).

- Turn the dial to the right to the last number (stop the first time on your last number).

- Pull the handle down; the door should open.

Dec 08, 2010 | Sentry Fireproof Safe

There are 4 sig figs (sfs) in 3.414.

Also,

The rule I use is the**"dot right-moving arrow"** rule.

I know it seems weird, but it is a very powerful rule, always reliable!

__Here is what you do__:

If the number has a dot in it (that is, if it has a decimal in it), imagine an arrow swooshing from left to right through the number. Start counting sig figs as soon as the imaginary arrow strikes a non-zero digit. Every digit the arrow goes through after it hits that first non-zero digit, is a significant digit (sig fig). The total number of sig figs is the sum of the first non-zero digit + all the following digits the arrow goes through after that. Very simple, right?

As an example, in 0.00098, the arrow sweeps through the leading zeros without counting until it stikes the first nonzero digit, 9. (BONK!!) So you must count it and the following digit (8). So the total number of sfs is only 2 for this number. Try it on the other numbers for practice.

__For a better closure, I guess I should explain the other related rule for sig figs__:

The "no-dot left arrow" rule. You can use this rule when a number does__not__ have a decimal in it. For example, the number 500 s. (I am using the same unit you gave in your quantities. As you can see, no decimal is shown. So you can not be sure the number has 3 sfs or not. It would only have 3 sig figs if you were informed it was an *exact* number. An exact number is a number which has been obtained by counting every object it represents. As in a classroom filled with 200 students, each one counted by their teacher during roll call.

To apply the*no-dot left-moving arrow* rule, simply imagine an arrow moving left until it hits the first non-zero digit. In this case, that digit is the 5, which is only one digit. Therefore, there is only 1 sig fig in 500 s.

Suggestion: Google up "sig figs" and get some more examples of quantities to practice counting sig figs. Also pay attention to the important related topic of proper rounding off of calculated quantities which have different numbers of sig figs. You will find this skill invaluable when you take a lab based chemistry or physics course!

Good luck!

###

Also,

- 4 sfs in 10.02
- 5 sfs in 58.325
- 2 sfs in 0.00098

The rule I use is the

I know it seems weird, but it is a very powerful rule, always reliable!

If the number has a dot in it (that is, if it has a decimal in it), imagine an arrow swooshing from left to right through the number. Start counting sig figs as soon as the imaginary arrow strikes a non-zero digit. Every digit the arrow goes through after it hits that first non-zero digit, is a significant digit (sig fig). The total number of sig figs is the sum of the first non-zero digit + all the following digits the arrow goes through after that. Very simple, right?

As an example, in 0.00098, the arrow sweeps through the leading zeros without counting until it stikes the first nonzero digit, 9. (BONK!!) So you must count it and the following digit (8). So the total number of sfs is only 2 for this number. Try it on the other numbers for practice.

The "no-dot left arrow" rule. You can use this rule when a number does

To apply the

Suggestion: Google up "sig figs" and get some more examples of quantities to practice counting sig figs. Also pay attention to the important related topic of proper rounding off of calculated quantities which have different numbers of sig figs. You will find this skill invaluable when you take a lab based chemistry or physics course!

Good luck!

###

Oct 11, 2010 | Scientific Explorer My First Chemistry Kit

The file number and folder number are reset every time a new card

is inserted in the camera. The folder number returns to [No. 100]

and the file number returns to [No. 0001].

AUTO This method is useful when you want to manage all your files

with sequential numbers.

Even if a new card is inserted, the folder number and file number are

retained from the previous card. This helps you to manage multiple cards.

To do this you go to the menu and to the setup option and press ok. Down arrow to file name and pick the option you want to use and press ok.

Apr 07, 2009 | Olympus Stylus 720 SW Digital Camera

Here is one solution. You might consider adding more robust error handling.

if the decimal numbers passed to the div function are multiples i will be a non-zero number of that multiple otherwise i will be zero.

Dim i As Integer

i = div(12, 0)

If i = 0 Then

'not multiple

' do this

Else

' is multiple

' do something else

End If

Function div(ByVal numerator As Object, ByVal denominator As Object) As Integer

dim n , d decimal

Dim result As Decimal

Dim remainder As Decimal

If IsNumber(numerator) Is True _

And IsNumber(denominator) Is True Then

If numerator <> 0 Then

n = numerator

d = denominator

Else

GoTo error1

End If

Else

GoTo error1

End If

result = Decimal.divide(n, d)

remainder = Decimal.remainder(n, d)

If remainder = 0 Then

div = result

Else

div = 0

End If

Exit Function

error1:

msgbox("Numbers must be non-zero numerics", , "Multiple check error")

div = 0

End Function

End Function

if the decimal numbers passed to the div function are multiples i will be a non-zero number of that multiple otherwise i will be zero.

Dim i As Integer

i = div(12, 0)

If i = 0 Then

'not multiple

' do this

Else

' is multiple

' do something else

End If

Function div(ByVal numerator As Object, ByVal denominator As Object) As Integer

dim n , d decimal

Dim result As Decimal

Dim remainder As Decimal

If IsNumber(numerator) Is True _

And IsNumber(denominator) Is True Then

If numerator <> 0 Then

n = numerator

d = denominator

Else

GoTo error1

End If

Else

GoTo error1

End If

result = Decimal.divide(n, d)

remainder = Decimal.remainder(n, d)

If remainder = 0 Then

div = result

Else

div = 0

End If

Exit Function

error1:

msgbox("Numbers must be non-zero numerics", , "Multiple check error")

div = 0

End Function

End Function

Aug 06, 2008 | Computers & Internet

GOTO: menu ,...settings and tools ... phone settings ... security ... (if you didn't set a pin number then it's the last 4 digits of your phone number OR 4 zero's )

There should be an option to reset the phone.

There should be an option to reset the phone.

Nov 23, 2007 | LG VX8300 Cellular Phone

115 people viewed this question

Usually answered in minutes!

×