InterviewSolution
Saved Bookmarks
| 1. |
0 2 0 2 0 2.. Print this series without using any string approach or conditional construct. Write in Java. |
|
Answer» java.util.Scanner;public CLASS Series { public STATIC VOID main(STRING[ ] args) { System.out.print("Enter N - "); INT N = new Scanner(System.in).nextInt( ); for (int i = 0; i < N * 2; i += 2) System.out.print((i & 2) + " "); }} |
|