Computer Applications

Generate the following series upto 10 terms:

1, 4, 7,10 ……

Java

Java Iterative Stmts

28 Likes

Answer

public class KboatSeries
{
    public static void main(String args[]) {
        int t = 1;
        for (int i = 1; i <= 10; i++) {
            System.out.print(t + " ");
            t += 3;
        }
    }
}

Output

Answered By

9 Likes


Related Questions