KnowledgeBoat Logo

Computer Applications

Write the program in Java to display the first ten terms of the following series:

1, 11, 111, 1111,

Java

Java Iterative Stmts

ICSE

61 Likes

Answer

public class KboatSeries
{
    public void generateSeries() {
        int term = 1;
        
        for (int i = 1; i <= 10; i++) {
            System.out.print(term + ", ");
            term = term * 10 + 1;
        }
    }
}

Output

BlueJ output of Write the program in Java to display the first ten terms of the following series: 1, 11, 111, 1111,

Answered By

29 Likes


Related Questions