0% found this document useful (0 votes)
2 views2 pages

Java Program Booklet ICSE2026

The document contains Java practice programs for ICSE Class 10, including solved examples for checking leap years, finding the largest of three numbers, calculating GCD, printing Fibonacci series, and listing prime numbers. It also includes unsolved problems such as printing patterns, checking Armstrong numbers, finding LCM, calculating series sums, and reversing strings. The document serves as a resource for students preparing for their exams in 2026.

Uploaded by

banerjeearchna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Java Program Booklet ICSE2026

The document contains Java practice programs for ICSE Class 10, including solved examples for checking leap years, finding the largest of three numbers, calculating GCD, printing Fibonacci series, and listing prime numbers. It also includes unsolved problems such as printing patterns, checking Armstrong numbers, finding LCM, calculating series sums, and reversing strings. The document serves as a resource for students preparing for their exams in 2026.

Uploaded by

banerjeearchna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

ICSE Class 10 - Java Practice Programs for 2026

Program 11: Check if a year is a leap year (Solved)

int year = 2024;


if((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0))
System.out.println("Leap Year");
else
System.out.println("Not a Leap Year");
Output: Leap Year

Program 12: Find the largest of 3 numbers (Solved)

int a = 12, b = 25, c = 19;


int max = (a > b) ? ((a > c) ? a : c) : ((b > c) ? b : c);
System.out.println("Largest: " + max);
Output: 25

Program 13: Calculate GCD of two numbers (Solved)

int a = 20, b = 28;


int gcd = 1;
for(int i = 1; i <= a && i <= b; i++) {
if(a % i == 0 && b % i == 0)
gcd = i;
}
System.out.println("GCD: " + gcd);
Output: 4

Program 14: Print Fibonacci series up to n terms (Solved)

int n = 7, a = 0, b = 1;
System.out.print(a + " " + b);
for(int i = 2; i < n; i++) {
int c = a + b;
System.out.print(" " + c);
a = b;
b = c;
}
Output: 0 1 1 2 3 5 8

Program 15: Print all prime numbers from 1 to 50 (Solved)

for(int i = 2; i <= 50; i++) {


int count = 0;
ICSE Class 10 - Java Practice Programs for 2026
for(int j = 2; j <= i/2; j++) {
if(i % j == 0) {
count++;
break;
}
}
if(count == 0)
System.out.print(i + " ");
}
Output: 2 3 5 7 11 13 ... 47

Program 16: Write a program to print this pattern (Unsolved)

*
**
***
****
*****
Output: // Write a loop to print the pattern above// Use nested loops

Program 17: Write a program to check if a number is Armstrong (Unsolved)

// Input a number and check if it's equal to the sum of the cubes of its digits
// Example: 153 = 1³ + 5³ + 3³

Program 18: Write a program to find LCM of two numbers (Unsolved)

// Take two numbers and find their LCM using loop


// LCM(a, b) = (a * b) / GCD(a, b)

Program 19: Write a program to find sum of series: 1 + 1/2 + 1/3 + ... + 1/n (Unsolved)

// Use a loop and double type to calculate the sum

Program 20: Write a program to reverse a string (Unsolved)

// Input: 'ICSE'
// Output: 'ESCI'
// Use charAt and loop backwards

You might also like