+ 3
Java Program to print the following pattern
7 14 15 28 29 30 31 56 57 58 59 60 61 62 63
1 Answer
+ 2
//How about this?
public class Program
{
public static void main(String[] args) {
for(int i = 1, ii = 1; i <= 4; i++, ii *= 2)
{
for(int j = 0, n = 7 * ii; j < ii ; ++j, ++n)
{
System.out.print(n + " ");
}
System.out.println("");
}
}
}
//Sorry it is dirty code.