I need to know, what is the problem with my overflow algorithm?, In Fortran I have to do an algorithm to return the number of the increment "n" when it reach the overflow break.
program overflow
integer::n,i,fact;
fact = 1;
n = 50;
do i=1,n,1
fact=fact*i;
if ((fact==abs(fact)).and.(fact /= 0)) then
print*,"F!=",fact;
n=n+1;
!print*,"Overflow=",n;
end if;
end do;
print*,n;
end program overflow
Its contains negative values, and "mutations" in factorial before reach the number that means "overflow", but it's false, n should be 15.