Question about Computers & Internet

1 Answer

I have a problem

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....

Posted by on

1 Answer

  • Level 2:

    An expert who has achieved level 2 by getting 100 points


    An expert that gotĀ 5 achievements.


    An expert whose answer gotĀ voted for 20 times.


    An expert who has written 20 answers of more than 400 characters.

  • Expert
  • 95 Answers

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.

Posted on Sep 17, 2008

1 Suggested Answer

  • 2 Answers

SOURCE: I have freestanding Series 8 dishwasher. Lately during the filling cycle water hammer is occurring. How can this be resolved

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.

Posted on Jan 02, 2017

Add Your Answer

Uploading: 0%


Complete. Click "Add" to insert your video. Add



Related Questions:

1 Answer

Needs blacklist incomming call software

Some telephone-companies offer per-number blocking. I just dial "STAR-SIX-ZERO",
and choose the option to "block last number that called me".

Nov 29, 2010 | Computers & Internet

1 Answer

Hey! I am trying to use this Microsoft Office Student and Teacher Edition 2003 disk but the product key I was given by my friend says in valid. When I tried to use the product key that was listed in a...

Re-type the product key in all caps and then in lower case to see if the system will take it. Also, don't confuse the number zero with the letter zero and vice versa. If that don't help, then call Microsoft on the toll free line which you can get from and ask the rep for a product key.

Oct 06, 2010 | Computers & Internet

3 Answers

9999555533331111 out of these numbers any 6 numbers total is 21? how

this would be explained on the basis of two FACTS below.......
sum of two odd numbers are always even and
sum of to even numbers are also always even

then how 6 odd numbers (consider 3 pairs, 9 5 3 1 being odd numbers) can make an odd number 21..!!
Make your basics strong...

Aug 14, 2010 | Computers & Internet

1 Answer

Need to restore to factory Settings don't have discs

If your system came with a recovery cd and you have lost it, the only things you can do is either , do a system restore back to the last restore point shown. Or purchase a new CD disk.

If yous system did not come with a recovery disk, then it is possible there is a recovery image of windows residing on the D:\ drive partition of your hard drive. If this is the case, when you boot up the computer and it's on the black screen, you should be given an option something like "Press F10 for Setup" . If you press F10 you will have options on how to recover the PC to factory defaults.

Jun 16, 2010 | Computers & Internet

3 Answers

On 3/17/08 I purchased a Windows XPPRO genuine adv. kit order no. 25116082458. I did as recommended, put it away until I needed to reinstall windows. This past weekend I did that and the new product key I...

Well, given that the two "missing" characters are either 0 to 9 or A to Z,
there are 36*36 (1272) different possible combinations.

So, if you are "average", and use "brute-force" attempts, you will have to make 636 attempts. If you are "lucky", you'll get the correct characters in less than 300 attempts.

Good luck!

Hint: Note that "digits" are somewhat rare in each 5-character group.
So, try 'AA' through 'ZZ' before trying any pair that contains a digit.
Try "two-digits" only as a last resort.

Sep 14, 2009 | Computers & Internet

1 Answer

Program of c to find largest and second larhest number of given 50 numbers using array

This code generates some random number to test.

#include <limits.h>
#include <stdio.h>
#include <stdlib.h>

int main()
{ findLargest();
return 0;

int findLargest()
{ int someNumbers[50];
int i;

// to generate some numbers for us to test
for(i=0; i<50; i++)
// generate a random number between 0-100
someNumbers[i] = rand() % 100;

// for keeping track of numbers, set as smallest possible
int largest = INT_MIN;
int largest2 = INT_MIN;

// go through each item in the array
for(i=0; i<50; i++)
{ // if bigger than our previous max, set as new max
if (someNumbers[i] > someNumbers[largest])
largest = i;
// if it's not been set as new max, and is bigger than current 2nd largest
else if(someNumbers[i] > someNumbers[largest2])
largest2 = i;

// for printing all numbers in the array
printf("%d | %d\n",i, someNumbers[i]);

// print largest numbers and their position in the array
printf("largest %d (pos %d).\n2nd largest %d (pos %d)",

return 0;


May 07, 2009 | Computers & Internet

1 Answer

Need Formula

Convert to UPPER, Proper or lower
Auto Convert to UPPER, Proper or lower
Stop VBA Being Case Sensitive

Select Case Statement. Great alternative to Else If Statements

VBA: CBool(),CByt(),CCur(),CDate(),CDbl()Double,CDec(),CInt(),CLng(),CSng(),CStr(),CVar().
Convert Numbers to Words
Convert Numbers to Dollar Amount in Words
Spreadsheet Converter. Versions: HTML/JavaScript,Excel ASP.Net and Excel Java/JSP. $
SQL Database Migration $
Converters. Database Converters, Spreadsheet Converters, Text Converters, E-mail Conversion, Document Conversion, PDF Conversion and more! $
CSV Converter $

Import SQL Into Excel-SQL Tester $
Import Excel Into Access $

Conditional Formatting
More Than 3 Conditional Formats
Conditional Format Fonts for greater than 3

Custom Formats
Excel see a cells format as having four Sections. These are, from left to right: Positives;Negatives;Zeros;Text.

To hide zeros cell-by-cell use a Custom Number Format like 0.00;-0.00; where 0.00 is desired format for non zeros. Note the use of -0.00 for negatives.

To hide zeros on the Workbook level go to Tools>Options>View - Zero Values.

Dec 15, 2008 | Microsoft Windows XP Home Edition

1 Answer

Programs with variable number of arguments

To start points and lines are not shapes, and a triangle is not representable with a single function, therefore you need a function to draw shapes , given a number of points as parameters, and one to draw math functions (lines etc.).

Here is an example: Draw Line, Ellipse, Polygon ...

From website above, here is script in JS:

"<script type="text/javascript">
function myDrawFunction()
jg_doc.setColor("#00ff00"); // green
jg_doc.fillEllipse(100, 200, 100, 180); // co-ordinates related to the document
jg_doc.drawPolyline(new Array(50, 10, 120), new Array(10, 50, 70));
jg_doc.paint(); // draws, in this case, directly into the document

jg.setColor("#ff0000"); // red
jg.drawLine(10, 113, 220, 55); // co-ordinates related to "myCanvas"
jg.setColor("#0000ff"); // blue
jg.fillRect(110, 120, 30, 60);

jg2.setColor("#0000ff"); // blue
jg2.drawEllipse(10, 50, 30, 100);
jg2.drawRect(400, 10, 100, 50);

var jg_doc = new jsGraphics(); // draw directly into document
var jg = new jsGraphics("myCanvas");
var jg2 = new jsGraphics("anotherCanvas");



Oct 25, 2008 | Computers & Internet

8 Answers

Sigmatel S3



Sep 21, 2008 | Microsoft Windows Vista Home Premium with...

Not finding what you are looking for?
Computers & Internet Logo

Related Topics:

114 people viewed this question

Ask a Question

Usually answered in minutes!

Top Computers & Internet Experts

Brian Sullivan
Brian Sullivan

Level 3 Expert

27725 Answers


Level 3 Expert

98868 Answers

David Payne
David Payne

Level 3 Expert

14086 Answers

Are you a Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides