Other than using the int data type as the index value in C + + for loop

I am accepting an input from user as a float value.

This value can go up to “10 raised to power 18″.

The next step involves finding all the divisors of this number. for which i am doing the following:

      for(i=2; i<=n/2 ; i++)
         {if(n%i==0)
          v.push_back(i);}

Here, n is the number entered by the user.

Problem is that n is float and using it in if loop index causes it’s value to be limited to ’10 raised to the power 9′

Hence, is there any way to use data type other than int for using values of range ’10 raised to power 18′?

This entry was posted in Codes & Scripts and tagged , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>