ICSE Class 10 · Computer Applications (Java) · Series programs 2027

Series programs in Java for ICSE, grouped by the loop that generates them.

Series programs in Java for ICSE either print the first n terms of a sequence or add them up. Every one of them is a single loop, and what differs is where the next term comes from: the loop counter, the term before it, the two terms before it, a sign that flips, or a factorial that grows. This page sorts fourteen series into those five loop patterns, gives a print or sum version of each, with the result Java 21 actually printed, and shows how the same work is done in our live mini batch.

Live online · fourteen series, five loop patterns · print and sum versions · Fibonacci and factorial without recursion · first class free

Start here

Courses where series programs are taught

The ICSE Java course where these series form part of the weekly batch work, the Class 11 and 12 Computer Science course where series return inside ISC programs, and the CBSE Class 10 Maths prep course for a student who wants the sequences and progressions behind them on firmer ground.

Ans. The short version

Series programs in Java for ICSE Class 10 print the first n terms of a sequence or find the sum of a series using one loop. They fall into five loop patterns: the term is a formula in the counter (1/i²), it is built from the previous term (1, 11, 111), it is the sum of the two before it (Fibonacci), the sign alternates, or a factorial or running total grows inside the loop. Use double for fractions and long for large terms. Modern Age Coders teaches them live twice a week in a small ICSE batch in India, with private one to one lessons as the other option.

Q1. How do you recognise which loop a series needs?

Series generation in BlueJ: the five loop patterns

Write the first four terms in a column, then ask where each term comes from. If you can work out term i from i alone, it is pattern 1. If you need the term before it, it is pattern 2. Two terms before it: pattern 3. A sign that flips: pattern 4. A product or total that keeps growing: pattern 5.

PatternExample seriesThe line that makes the termOn this page
1. Term from the counter2, 5, 10, 17, ...term = i * i + 1;Q2
2. Term from the previous term1, 11, 111, 1111, ...t = t * 10 + 1;Q3
3. Term from the two previous terms0, 1, 1, 2, 3, 5, ...c = a + b; a = b; b = c;Q4
4. Alternating sign1 - 2 + 3 - 4 + ...s = s + sign * i; sign = -sign;Q5
5. Running factorial or total1! + 2! + 3! + ...f = f * i; s = s + f;Q5

Print version or sum version?

The loop is the same in both. A print version calls System.out.print(term + " ") inside the loop. A sum version declares s = 0 before the loop, adds each term with s = s + term, and prints s once, after the loop. Printing s inside the loop is the most common slip: the answer then shows every partial sum instead of one total.

ChooseWhenWhy
intWhole-number terms that stay smallExact and simple
longTerms that grow fast: 1, 11, 111, powers, factorials13! is already past the int limit of about 2.1 billion
doubleAny term with division or Math.pow1 / (i * i) in int arithmetic is 0 for every i above 1

Q2. How do you write a sum of series program in Java?

Sum of series program ICSE: when the term is a formula in i

If term i can be written straight from i, put that formula inside a for loop from 1 to n. Use a decimal point (1.0) or Math.pow whenever the term divides, so Java works in double.

FromCounter.javapattern 1: term from i
class FromCounter {
    static void printTerms(int n) {              // 2, 5, 10, 17, ...
        for (int i = 1; i <= n; i++)
            System.out.print(i * i + 1 + " ");
        System.out.println();
    }
    static void sumTerms(int n) {                // 1 + 1/4 + 1/9 + ... + 1/n^2
        double s = 0;
        for (int i = 1; i <= n; i++)
            s = s + 1.0 / (i * i);
        System.out.println("Sum = " + s);
    }
    static void oddPowers(double x, int n) {     // x + x^3 + x^5 + ... n terms
        double s = 0;
        for (int i = 1; i <= n; i++)
            s = s + Math.pow(x, 2 * i - 1);
        System.out.println("Sum = " + s);
    }
    public static void main(String args[]) {
        printTerms(6);
        sumTerms(4);
        oddPowers(2, 4);
    }
}
OutputJava 21
2 5 10 17 26 37
Sum = 1.4236111111111112
Sum = 170.0

In printTerms, i * i + 1 is worked out before the String " " joins it, because * and the first + both act on numbers. oddPowers for x = 2 is 2 + 8 + 32 + 128, which is 170; Math.pow returns double, so Java prints 170.0.

Finding the formula for term i

  1. Write i above each term. For 2, 5, 10, 17 the pairs are (1, 2), (2, 5), (3, 10), (4, 17).
  2. Compare with i, i², 2i and 2i - 1. Each term is one more than i², so term = i * i + 1.
  3. For powers, look at the exponents. x, x³, x⁵ have exponents 1, 3, 5, which is 2i - 1.
  4. Check term 4 with the formula before writing the loop. If it is wrong, the whole series is wrong.

Math.pow, Math.sqrt and the other Math methods a series may need, with their return types, are on Math library methods for ICSE Class 10.

Q3. What if each term depends on the one before it?

Series built from the previous term: 1, 11, 111 and friends

Keep the current term in a variable outside the loop and update it once per pass. The update line is the whole idea: multiply by 10 and add a digit, multiply by a ratio, or add a growing gap.

FromPrevious.javapattern 2: term from the last term
class FromPrevious {
    static void ones(int n) {                    // 1, 11, 111, ...
        long t = 0;
        for (int i = 1; i <= n; i++) {
            t = t * 10 + 1;
            System.out.print(t + " ");
        }
        System.out.println();
    }
    static void sumTwos(int n) {                 // 2 + 22 + 222 + ...
        long t = 0, s = 0;
        for (int i = 1; i <= n; i++) {
            t = t * 10 + 2;
            s = s + t;
        }
        System.out.println("Sum = " + s);
    }
    static void times3(int n) {                  // 1, 3, 9, 27, ...
        long t = 1;
        for (int i = 1; i <= n; i++) {
            System.out.print(t + " ");
            t = t * 3;
        }
        System.out.println();
    }
    static void growingGaps(int n) {             // 1, 2, 4, 7, 11, ...
        int t = 1;
        for (int i = 1; i <= n; i++) {
            System.out.print(t + " ");
            t = t + i;
        }
        System.out.println();
    }
    public static void main(String args[]) {
        ones(5);
        sumTwos(4);
        times3(7);
        growingGaps(8);
    }
}
OutputJava 21
1 11 111 1111 11111
Sum = 2468
1 3 9 27 81 243 729
1 2 4 7 11 16 22 29

Look at the order of the two lines inside each loop. In ones the term is updated and then printed, so t starts at 0. In times3 it is printed and then updated, so t starts at 1. Both orders work if the starting value matches.

Pass it = t * 10 + 2s = s + t
122
22224
3222246
422222468

The growing-gaps series adds 1, then 2, then 3: the gap is the counter itself. Series like this are easy to misread as a formula in i; the term table in Q1 tells you quickly that the differences, not the terms, follow i. The loop habits behind all of this are practised on loop programs in Java for ICSE Class 10.

Q4. How do you print the Fibonacci series in Java for ICSE?

Fibonacci series Java ICSE: two variables that slide along

Each Fibonacci term is the sum of the two before it, starting 0 and 1. Keep the last two terms in a and b; each pass prints a, makes c = a + b, then slides the pair one place: a takes b, and b takes c. No recursion is needed, and recursion is not in the ICSE 2027 syllabus.

Fibonacci.javafirst n terms and their sum
import java.util.Scanner;
class Fibonacci {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        System.out.print("How many terms? ");
        int n = sc.nextInt();
        int a = 0, b = 1, sum = 0;
        for (int i = 1; i <= n; i++) {
            System.out.print(a + " ");
            sum = sum + a;
            int c = a + b;      // next term
            a = b;              // slide the pair along
            b = c;
        }
        System.out.println();
        System.out.println("Sum of the terms = " + sum);
    }
}

The order a = b, then b = c matters. Swap those two lines and both a and b take the new value, so the run prints 0 1 2 4 8 16, doubling instead of Fibonacci.

VariableTypePurpose
nintnumber of terms to print
a, bintthe current term and the one after it
cintthe next term, a + b
suminttotal of the printed terms
iintloop counter, 1 to n
Sample runJava 21
How many terms? 10
0 1 1 2 3 5 8 13 21 34
Sum of the terms = 88

Fibonacci terms up to a limit: while, not for

When the question gives a largest value instead of a number of terms, the count is unknown, so use while with the limit as the condition.

FibLimit.javaterms up to 100
class FibLimit {
    public static void main(String args[]) {
        int a = 0, b = 1;
        while (a <= 100) {
            System.out.print(a + " ");
            int c = a + b;
            a = b;
            b = c;
        }
        System.out.println();
    }
}
OutputJava 21
0 1 1 2 3 5 8 13 21 34 55 89

The next term, 144, fails a <= 100, so the loop stops after 89. A for loop to a fixed n could not know to stop here.

Checking whether one given number is a Fibonacci number, and other single-number tests, sit with the number families on special number programs in Java for ICSE.

Q5. How do you handle alternating signs and factorial series?

Factorial series ICSE and alternating signs, in one loop each

For a sign that flips, keep a variable sign that starts at 1 and is multiplied by -1 every pass, or test whether i is even. For a factorial series, never write a second loop to work out each factorial: multiply the running factorial by i, and it is ready for this term.

SignSeries.javapattern 4: alternating sign
class SignSeries {
    static void plusMinus(int n) {               // 1 - 2 + 3 - 4 + ... n terms
        int s = 0, sign = 1;
        for (int i = 1; i <= n; i++) {
            s = s + sign * i;
            sign = -sign;
        }
        System.out.println("Sum = " + s);
    }
    static void powerOverIndex(double x, int n) { // x - x^2/2 + x^3/3 - ...
        double s = 0;
        for (int i = 1; i <= n; i++) {
            double term = Math.pow(x, i) / i;
            if (i % 2 == 0)
                s = s - term;
            else
                s = s + term;
        }
        System.out.println("Sum = " + s);
    }
    public static void main(String args[]) {
        plusMinus(7);
        plusMinus(10);
        powerOverIndex(2, 4);
    }
}
OutputJava 21
Sum = 4
Sum = -5
Sum = -1.3333333333333335

For x = 2 and four terms: 2 - 2 + 8/3 - 4, which is -4/3. The two methods show both ways of flipping the sign; either earns the marks.

FactSeries.javapattern 5: running factorial and total
class FactSeries {
    static void sumOfFactorials(int n) {         // 1! + 2! + 3! + ... + n!
        long f = 1, s = 0;
        for (int i = 1; i <= n; i++) {
            f = f * i;           // f is now i!
            s = s + f;
        }
        System.out.println("Sum = " + s);
    }
    static void expSeries(double x, int n) {     // 1 + x/1! + x^2/2! + ... n terms after 1
        double term = 1, s = 1;
        for (int i = 1; i <= n; i++) {
            term = term * x / i;  // builds x^i / i! from the last term
            s = s + term;
        }
        System.out.println("Sum = " + s);
    }
    static void runningTotals(int n) {           // 1 + (1+2) + (1+2+3) + ...
        int p = 0, s = 0;
        for (int i = 1; i <= n; i++) {
            p = p + i;           // p is now 1 + 2 + ... + i
            s = s + p;
        }
        System.out.println("Sum = " + s);
    }
    public static void main(String args[]) {
        sumOfFactorials(5);
        expSeries(1, 10);
        runningTotals(5);
    }
}
OutputJava 21
Sum = 153
Sum = 2.7182818011463845
Sum = 35

1 + 2 + 6 + 24 + 120 is 153. With x = 1 the exp series adds 1/i! terms and creeps towards the number e, 2.71828. The running total adds 1, 3, 6, 10 and 15.

if = f * is = s + f
111
223
369
42433
5120153

Overloading questions often carry a series in one of their versions; that shape is covered on user-defined methods and overloading for ICSE Class 10, or as one option of a switch menu on menu driven programs for ICSE.

Q6. How are series taught in the live class?

Term table, code, hand check, BlueJ: a series lesson in the mini batch

The hard part of a series question is not the loop but reading the series correctly. Lessons spend their time there.

  1. A new series in board wording

    At the Tuesday 5:30 PM IST class, students get a series they have not met, written the way the paper writes it, sometimes with an x to read in.

  2. The term table

    Each student writes i beside the first four terms and names the loop pattern, then writes the one line that makes the term.

  3. Hand-written program and a hand sum

    The program is written on paper with a variable description table, and the sum of the first three terms is worked by hand as the check value.

  4. Run in BlueJ on a shared screen

    At the Wednesday 8:00 PM IST class the programs are run. If BlueJ disagrees with the hand sum, the group traces the loop to find whether the term, the type or the print position was wrong.

  5. Series inside overloading and full mocks

    Later in the year the same families come back as parts of whole mock papers, sat in two hours and marked question by question.

Every other Section B family has its own page, linked from ICSE Class 10 Java programs for practice, and nested loops that print shapes instead of numbers are on pattern programs for ICSE.

Batch or personalised: you choose

Practise series in the mini batch, or one to one

In both formats series are read with a term table, written by hand, checked against a hand sum and then run. Families in India choose between the fixed evening mini batch and a private slot; ICSE students abroad study one to one. Billing is monthly with no admission fee.

Option 1 · Fixed batch timings

Mini batch, Tuesday 5:30 PM and Wednesday 8 PM

₹2,999

per month, two live classes a week

  • Tuesday 5:30 PM and Wednesday 8:00 PM IST, live
  • Up to six ICSE Class 10 students per batch
  • A fresh series in board wording most weeks
  • Hand sums compared with BlueJ in front of the group
  • Series met again as parts of longer questions
Book a free demo in this batch

Option 2 · Choose your own timing

Personalised one to one

₹4,999

per month, one private class a week, at a time set with you

  • Lesson times fixed around your child's week
  • Slow, careful work on reading the series, the usual sticking point
  • Series taken from the school's own exercises
  • Harder x-series and factorial series once the basics hold
  • The batch teachers and syllabus, one student at a time
Ask for a personalised plan

Students who can code a loop but misread what the series is asking often need only a handful of one to one sessions on term tables. Students who want every Section B family covered in a steady rhythm are better placed in the twice-weekly batch. Each format's fee is listed in your local currency.

Studying outside India?

Series program practice for ICSE students abroad

ICSE schools outside India sit the same Computer Applications paper, so the same series turn up in Section B, often inside an overloading question. Families abroad book private lessons, timed for the end of their school day.

Where you liveTime differenceUsual class window, local timeFormat
India (IST)
every Indian city
ISTTue 5:30 PM, Wed 8:00 PMMini batch or 1-on-1
United Arab Emirates
Dubai, Sharjah
1 h 30 min behind India3:00 PM to 9:00 PMPersonalised 1-on-1
Indonesia and Thailand
West Java, Bangkok area
1 h 30 min ahead of India3:30 PM to 9:00 PMPersonalised 1-on-1
Singapore
Singapore
2 h 30 min ahead of India3:30 PM to 9:00 PMPersonalised 1-on-1

The slot is settled after the free demo and shifts around school tests when needed. Details for overseas families are on ICSE Computer Applications classes in the Gulf and abroad.

What families say

Rated 4.9 across 547 Google reviews

Real reviews from real families. We neither write nor commission them.

★★★★★

"The one step solution for my son. Modern Age Coders make learning coding so simple that kids love it. The teachers explain complex concepts clearly with practical exercises and interactive content."

Ria Mukherjee

Parent

★★★★★

"Modern Age Coders has been a game-changer for me. I struggled to grasp IT concepts and coding before joining, but their classes transformed everything. I can now confidently write complex programs with ease."

Samriddha Mondal

Student

★★★★★

"One of the most wonderful education centres out there. Education is not limited to school syllabus but focuses on skill development."

Vansh Agarwal

Student

★★★★★

"My child Dhairya is really enjoying the Modern Age Coders classes. This is his first online class and he eagerly looks forward to it. I can already see his improvement, and the teachers are very cooperative."

Sonam Oswal

Parent of Dhairya

★★★★★

"Modern Age Coders have wonderful teachers who teach in a clear, easy and practical way. The teacher boosts students' confidence and inspires them to learn without hesitation."

Sonu Goyal

Parent

★★★★★

"I highly recommend this computer coding class! The teachers are incredibly knowledgeable and passionate about coding."

Ritu Kedia

Parent

The rest of the Class 10 series

More pages for Class 10 board students

Every page in the ICSE Class 10 Computer Applications series, grouped by what you need: classes, each chapter, Section B programs, question practice, notes and revision, and the exam itself.

CBSE Class 10 AI (417): The Mon and Wed 9 PM AI batch CBSE AI 417 syllabus explained CBSE AI important questions Sample paper and mock tests

Questions about series programs

What students ask about ICSE series programs

How do you write a series program in Java?

Write the first four terms with their positions 1, 2, 3, 4, and find where each term comes from: a formula in the position, the previous term, the two previous terms, a flipping sign or a growing factorial. Then write one for loop from 1 to n that makes the term and either prints it or adds it to a sum.

How do you find the sum of a series in Java?

Declare a sum variable before the loop and set it to 0. Inside the loop, work out the current term and add it with s = s + term. Print s once, after the loop ends. Use double for s whenever any term involves division or Math.pow.

How do you print the Fibonacci series in Java without recursion?

Start with a = 0 and b = 1. In each pass of a loop print a, then set c = a + b, a = b and b = c. For the first n terms use a for loop; for all terms up to a limit use a while loop that runs as long as a has not passed the limit. Recursion is not needed and is not in the ICSE 2027 syllabus.

How do you write a factorial series program in Java?

Keep a running factorial f that starts at 1 and becomes f * i in each pass, so it equals i! for the current term. Add f, or a term built from it, to the sum. Do not write a separate inner loop for each factorial. Use long, because factorials pass the int limit at 13!.

Why does my series program print 0 for every term?

Usually because of integer division. In 1 / (i * i) both sides are int, so the answer is 0 for every i above 1. Write 1.0 / (i * i) or cast to double, and make the sum variable a double.

How do you handle alternating plus and minus signs in a series?

Keep an int sign that starts at 1, multiply each term by sign, and set sign = -sign at the end of every pass. Or test i % 2: add the term when i is odd and subtract it when i is even. Both are accepted.

How do you print the series 1, 11, 111, 1111 in Java?

Keep a term t that starts at 0, and in each pass set t = t * 10 + 1 and print it. The same idea with + 2 gives 2, 22, 222. Use long, because these terms grow by a factor of ten each time.

Which is better for series, a for loop or a while loop?

Use for when the number of terms n is given, because the counter doubles as the term position. Use while when the series must stop at a value, such as all terms up to 100, because the number of passes is not known in advance.

Are series programs important for ICSE Class 10?

They matter a lot. Series test loops, data types and careful reading at once. They come as whole Section B programs, and also as one branch of a larger overloading or menu program. Getting the term right is most of the work.

Do you teach series programs in live classes?

We do. Each week the small ICSE batch meets a new series, reads it with a term table, writes the program by hand, checks a hand sum and runs it in BlueJ on a shared screen. Private one to one lessons are the alternative when batch times clash.

Start

Book a free series lesson, live

During the demo your child reads an unfamiliar series with the mentor, builds the term table, writes the loop and checks a hand sum against BlueJ. Afterwards you get an honest view of where the gaps are, reading, types or loops, and whether the mini batch or one to one suits better.

Planning the whole year? Start from ICSE Computer Applications important questions or the ICSE Class 10 Java classes.

WhatsApp us · +91 91233 66161 · connect@modernagecoders.com

Every class is live video. The form requests a callback and reserves nothing.

We call within a few hours. No card, no enrolment fee.

Want it sooner? Book a priority demo

A full live class of about 45 to 60 minutes at a slot you pick, with a written skill report and learning roadmap on WhatsApp afterwards. The fee is adjusted against your first month if you enrol.

Book a priority demo

Keep exploring Modern Age Coders

By class and age

Learn more

Free resources

From the blog

Start here