Write a program in Java to print a series 1,4,7,10……… upto 12 terms.
8 Likes
public class KboatSeries { public static void main(String args[]) { for (int i = 1; i <= 34; i += 3) { System.out.print(i + " "); } } }
Answered By
4 Likes
How many times will the following loop execute? Write the output of the code:
int x=10; while (true){ System.out.println(x++ * 2); if(x%3==0) break; }
Rewrite the following do while program segment using for:
x = 10; y = 20; do { x++; y++; } while (x<=20); System.out.println(x * y );