- Where Developers Learn, Share, & Build Careers
I tried to find the factual number of a large number eg Using a loop and double data type in 8785856 in a specific way.
But it is displaying infinity as a result, maybe because it exceeds its limit.
My code:
class abc {public static void main (string [] args) {double fact = 1; (Int i = 1; i & lt; = 8785856; i ++) for {fact = fact * i; } System.out.println (facts); }} Output: -
Infinity I'm new to Java but some of the Io concepts Have learned - Ningling and all.
public static zero main (string [] args) {BigInteger Facts = Bigtega. 1); For (int i = 1; i & lt; = 8785856; i ++) Fact = facts Multiply (BigInter.Voof (I)); Println (fact); }
Comments
Post a Comment