Search results

  1. H

    C/++/# C++ programming on prime numbers

    That output looks right for that code. Let's look at your two cases to see what the program actually does. If p=9, p/2=4 (remember integer division). Due to the test in the for loop, you will test the values i=2 and i=3. In the case of i=2, 9%2=1 and it prints prime no matter what the later...
  2. H

    Fortran Problem setting integer precision in Fortran

    Ah yes, I was definitely wrong. http://gcc.gnu.org/onlinedocs/gfortran/SELECTED_005fINT_005fKIND.html Based on this discussion http://gcc.1065356.n5.nabble.com/problem-with-integer-kind-td751850.html it seems that gfortran doesn't care about the type of the integer on lhs when it looks at the...
  3. H

    Fortran Problem setting integer precision in Fortran

    I'm not used to Fortran, but the error message just indicates that you can't fit such a large number into that kind of integer. Assuming 32 denotes the number of bits used to store the number, the largest number you can achieve is 2^31-1=2147483647, which is smaller than your number. Try a 64...
Top