COMPUTER SCIENCE
PROJECT
YEAR 2025-26
NAME : ABC
CLASS: X
ROLL NUMBER : 13
TEACHER’S NAME: MRS. A
SCHOOL NAME: CITY MONTESSORI SCHOOL
__________________ ____________________
INTERNAL SIGNATURE EXTERNAL SIGNATURE
ACKNOWLEDGEMENT
I would like to express my sincere
gratitude to Mrs.A, my respected
Computer teacher, for her valuable
guidance, encouragement, and support
throughout the completion of this project.
Her constant motivation and insightful
suggestions have been instrumental in
shaping my understanding and helping me
successfully complete this work.
I am also thankful to my school and my
classmates of Class X-C for providing a
positive and inspiring environment that
made this project possible.
Finally, I extend my heartfelt appreciation
to my parents and everyone who directly
or indirectly supported me in the
preparation of this Computer Project.
PROGRAM - 1
Write a program to display the following pattern:
public class Pattern1 {
public static void main(String args[]) {
for(int i = 1; i <= 4; i++) {
for(int j = 1; j <= i; j++) {
[Link]("* ");
}
[Link]();
}
}
}
OUTPUT
PROGRAM - 2
Write a program to display the pattern:
A
AB
ABC
ABCD
public class PatternChar {
public static void main(String args[]) {
for(int i = 1; i <= 4; i++) {
char ch = 'A';
for(int j = 1; j <= i; j++) {
[Link](ch + " ");
ch++;
[Link]();
OUTPUT
PROGRAM - 3
Write a program to print:
1
12
123
1234
public class PatternInt {
public static void main(String args[]) {
for(int i = 1; i <= 4; i++) {
for(int j = 1; j <= i; j++) {
[Link](j + " ");
[Link]();
OUTPUT
PROGRAM – 4
Write a program to check if a number is Armstrong using a function cube(int).
import [Link].*;
public class Armstrong {
int cube(int n) {
return n * n * n;
public static void main(String args[]) {
Scanner sc = new Scanner([Link]);
Armstrong obj = new Armstrong();
[Link]("Enter number: ");
int n = [Link]();
int temp = n, sum = 0;
while(temp > 0) {
int d = temp % 10;
sum += [Link](d);
temp /= 10;
if(sum == n)
[Link]("Armstrong Number");
else
[Link]("Not Armstrong");
}
PROGRAM – 5
Write a program using a function fact(int) to find the factorial of a number.
import [Link].*;
public class Factorial {
int fact(int n) {
int f = 1;
for(int i = 1; i <= n; i++)
f = f * i;
return f;
public static void main(String args[]) {
Scanner sc = new Scanner([Link]);
Factorial obj = new Factorial();
[Link]("Enter number: ");
int n = [Link]();
[Link]("Factorial = " + [Link](n));
}
PROGRAM – 6
Write a menu-driven program to perform Addition or Subtraction of two numbers based on
the user’s choice.
import [Link].*;
public class MenuCalc {
public static void main(String args[]) {
Scanner sc = new Scanner([Link]);
[Link]("1. Addition");
[Link]("2. Subtraction");
[Link]("Enter your choice: ");
int ch = [Link]();
[Link]("Enter first number: ");
int a = [Link]();
[Link]("Enter second number: ");
int b = [Link]();
switch(ch) {
case 1:
[Link]("Sum = " + (a + b));
break;
case 2:
[Link]("Difference = " + (a - b));
break;
default:
[Link]("Invalid Choice");
}
PROGRAM - 7
Write a program to check if a given number is prime.
import [Link].*;
public class PrimeCheck {
public static void main(String args[]) {
Scanner sc = new Scanner([Link]);
[Link]("Enter number: ");
int n = [Link]();
int c = 0;
for(int i = 1; i <= n; i++) {
if(n % i == 0)
c++;
if(c == 2)
[Link]("Prime Number");
else
[Link]("Not Prime");
}
PROGRAM – 8
Write a program to check whether a number is a palindrome (same forward and backward).
import [Link].*;
public class Palindrome {
public static void main(String args[]) {
Scanner sc = new Scanner([Link]);
[Link]("Enter number: ");
int n = [Link]();
int temp = n, rev = 0;
while(temp > 0) {
int d = temp % 10;
rev = rev * 10 + d;
temp /= 10;
if(rev == n)
[Link]("Palindrome Number");
else
[Link]("Not Palindrome");
}
PROGRAM – 9
Write a program to find the sum of digits of a number.
import [Link].*;
public class PrimeCheck {
public static void main(String args[]) {
Scanner sc = new Scanner([Link]);
[Link]("Enter number: ");
int n = [Link]();
int c = 0;
for(int i = 1; i <= n; i++) {
if(n % i == 0)
c++;
if(c == 2)
[Link]("Prime Number");
else
[Link]("Not Prime");
}
PROGRAM – 10
Write a program to reverse a given number.
import [Link].*;
public class Reverse {
public static void main(String args[]) {
Scanner sc = new Scanner([Link]);
[Link]("Enter number: ");
int n = [Link]();
int temp = n, rev = 0;
while(temp > 0) {
int d = temp % 10;
rev = rev * 10 + d;
temp /= 10;
[Link]("Reversed number = " + rev);
}
PROGRAM – 11
Write a program to calculate the area of:
1. Circle (using area(double r))
2. Rectangle (using area(int l, int b))
Use function overloading.
import [Link].*;
public class AreaOL {
double area(double r) {
return 3.14 * r * r;
int area(int l, int b) {
return l * b;
public static void main(String args[]) {
Scanner sc = new Scanner([Link]);
AreaOL obj = new AreaOL();
[Link]("Enter radius: ");
double r = [Link]();
[Link]("Area of Circle = " + [Link](r));
[Link]("Enter length: ");
int l = [Link]();
[Link]("Enter breadth: ");
int b = [Link]();
[Link]("Area of Rectangle = " + [Link](l, b));
}
PROGRAM – 12
Write a program using function overloading to calculate the volume of:
Cube → volume(int side)
Cuboid → volume(int l, int b, int h)
import [Link].*;
public class VolumeOL {
int volume(int a) {
return a * a * a;
int volume(int l, int b, int h) {
return l * b * h;
public static void main(String args[]) {
Scanner sc = new Scanner([Link]);
VolumeOL obj = new VolumeOL();
[Link]("Enter side of cube: ");
int a = [Link]();
[Link]("Volume of Cube = " + [Link](a));
[Link]("Enter length, breadth, height: ");
int l = [Link]();
int b = [Link]();
int h = [Link]();
[Link]("Volume of Cuboid = " + [Link](l, b, h));
}
PROGRAM – 13
Write a program to input two numbers using a constructor and display their sum.
import [Link].*;
public class SumConst {
int a, b;
SumConst(int x, int y) {
a = x;
b = y;
}
void display() {
[Link]("Sum = " + (a + b));
}
public static void main(String args[]) {
Scanner sc = new Scanner([Link]);
[Link]("Enter first number: ");
int x = [Link]();
[Link]("Enter second number: ");
int y = [Link]();
SumConst obj = new SumConst(x, y);
[Link]();
}
}
PROGRAM – 14
Write a program to input a number using a constructor and check whether it is even or odd.
import [Link].*;
public class EvenOddConst {
int n;
EvenOddConst(int x) {
n = x;
void check() {
if(n % 2 == 0)
[Link]("Even Number");
else
[Link]("Odd Number");
public static void main(String args[]) {
Scanner sc = new Scanner([Link]);
[Link]("Enter number: ");
int x = [Link]();
EvenOddConst obj = new EvenOddConst(x);
[Link]();
}
PROGRAM – 15
Write a program to input 5 numbers in an array and print the largest number.
import [Link].*;
public class MaxArray {
public static void main(String args[]) {
Scanner sc = new Scanner([Link]);
int a[] = new int[5];
[Link]("Enter 5 numbers:");
for(int i = 0; i < 5; i++)
a[i] = [Link]();
int max = a[0];
for(int i = 1; i < 5; i++) {
if(a[i] > max)
max = a[i];
[Link]("Largest number = " + max);
}
PROGRAM – 16
Write a program to input 10 numbers in an array and count how many are even and how many are odd.
import [Link].*;
public class CountEvenOdd {
public static void main(String args[]) {
Scanner sc = new Scanner([Link]);
int a[] = new int[10];
[Link]("Enter 10 numbers:");
for(int i = 0; i < 10; i++)
a[i] = [Link]();
int ec = 0, oc = 0;
for(int i = 0; i < 10; i++) {
if(a[i] % 2 == 0)
ec++;
else
oc++;
[Link]("Even numbers: " + ec);
[Link]("Odd numbers: " + oc);
}
PROGRAM - 17
Write a program to input a string and count the number of vowels.
import [Link].*;
public class CountVowels {
public static void main(String args[]) {
Scanner sc = new Scanner([Link]);
[Link]("Enter a word: ");
String s = [Link]();
int c = 0;
for(int i = 0; i < [Link](); i++) {
char ch = [Link](i);
if("AEIOUaeiou".indexOf(ch) != -1)
c++;
[Link]("Total vowels = " + c);
}
PROGRAM – 18
Write a program to input a string and print its reverse.
import [Link].*;
public class ReverseString {
public static void main(String args[]) {
Scanner sc = new Scanner([Link]);
[Link]("Enter a string: ");
String s = [Link]();
String rev = "";
for(int i = [Link]() - 1; i >= 0; i--)
rev = rev + [Link](i);
[Link]("Reversed string = " + rev);
}
PROGRAM – 19
Write a program to check if a string is palindrome.
import [Link].*;
public class PalStr {
public static void main(String args[]) {
Scanner sc = new Scanner([Link]);
[Link]("Enter string: ");
String s = [Link]();
String rev = "";
for(int i = [Link]() - 1; i >= 0; i--)
rev += [Link](i);
if([Link](rev))
[Link]("Palindrome String");
else
[Link]("Not Palindrome");
}
PROGRAM – 20
Write a program to input n numbers and find their average.
import [Link].*;
public class AverageN {
public static void main(String args[]) {
Scanner sc = new Scanner([Link]);
[Link]("Enter value of n: ");
int n = [Link]();
int sum = 0;
[Link]("Enter " + n + " numbers:");
for(int i = 1; i <= n; i++) {
int x = [Link]();
sum += x;
double avg = (double)sum / n;
[Link]("Average = " + avg);
}
BIBLIOGRAPHY
Touchpad iPrime Computer Applications with BlueJ – ICSE Class 10” by Orange Education.
Class notebook