PowersOfTwo.java
public class PowersOfTwo
{
public static void main(String[] args)
{
int N = Integer.parseInt(args[0]);
int i = 0;
int powerOfTwo = 1;
while (i <= N)
{
System.out.println(i + " " + powerOfTwo);
powerOfTwo = 2 * powerOfTwo;
i = i + 1;
}
}
}
No comments:
Post a Comment