Expand|Select|Wrap|Line Numbers
- // File Name: PowerOf2.java
- // Name of Creator: MITCHEL WRIGHT
- // Date Started: 12-04-2006
- // Date Finished: 12-04-2006
- // Purpose: to find "2 to the power of #=____"
- // Assignment: Create a program that will tell you
- // "2 to the power of 0 is 1"-"2 to the power of 295 is 6.36574E+88"
- //===============PowerOf2.java======================
- public class PowerOf2
- {
- public static void main (String args[])
- { int intarray[]= new int [296];
- for (int I=0;I<=295; I++)
- {
- intarray[i]=1;
- for (int p=0; p<I;p++)
- {
- intarray[i]*=2;
- }
- for (int i=0; i<1; i++)
- System.out.println("2 to the power of "+I+" is " + intarray[i]);
- }
- }
- }