Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 17

Computer

PROJECT
WORK

NAME: SOUMODEEP BORAL.


CLASS: XI; SEC: A; ROLL NO: 21.
SESSION: 2023-2024.
Index

Sl. No Description Page No


1 Programme 1 – Merge Arrays 1-2
2 Programme 2 – Sort names 3-4
3 Programme 3 – sort string 5-6
4 Programme 4 - Second max character 7-8
5 Programme 5 - Sentence encryption 9-10
6 Programme 6 – checking disarium using 11-12
recursion
7 Programme 7 – magic square 13-14
8 Programme 8 – matrix sorting using any 15-17
standard means
9 Programme 9 - Printing uncommon characters 18-19
from the words given in a sentence

10 Programme 10 – smith number 20-21


12 Programme 11 – circular matrix 22-23
13 Programme 12 – printing sum of gap in gap in a 24-25
sentence

Programme – 6
Output:

Enter a number
175
It is a disarium number

Enter a number
346
It is not a disarium number

Variable description
Variable Description

num
Used in the sumofDigits and isDisarium methods. In sumofDigits, it represents the
number being processed. In isDisarium, it stores the original number being checked.

size
Used in the sumofDigits and isDisarium methods. In both methods, it represents the
number of digits in num.

value Used in the isDisarium method to store the result of the sumofDigits method.

n Used in the main method to store the number input by the user.

ob Used in the main method to create an instance of the Disarium_Number class.

Programme – 7
Output:
Give an odd number: 3
610
345
978

Variable description
Variable Description

n
Used to store the odd number input by the user. This number also determines the
size of the magic square.

magicSquare A 2D array that represents the magic square. Its size is n x n.

num
Used to store the current number being placed in the magic square. It starts at 1
and goes up to n * n.

r Represents the current row index in the magic square where num is being placed.

c
Represents the current column index in the magic square where num is being
placed.

Programme – 8
Output:
Enter the number of rows:3

Enter the number of columns:3

Enter the elements of the matrix:


4

Sorted matrix:

123

456

789

Variable description
Variable Description

rows Used to store the number of rows in the matrix, as input by the user.

cols Used to store the number of columns in the matrix, as input by the user.

matrix A 2D array that represents the matrix. Its size is rows x cols.

temp A 1D array used to store all elements of the matrix for sorting. Its size is rows * cols.

k Used as an index for the temp array.

i and j Used as indices in the loops to traverse the matrix and the temp array.

swap Used to swap elements in the temp array during the sorting process.

Programme – 9
Output:
THE UNCOMMON CHARACTERS ARE: pplsd
Programme – 10
Output:
Enter a number: 202

It is a Smith Number

Enter a number: 27

It is a Smith Number

Enter a number: 999

Not a Smith number

Variable description

Variable Description

n The number input by the user and checked if it’s a Smith number.

c A counter variable used in the Sopf method to iterate through potential factors of n.

ob An object of the Smith_Number class, used to call the methods in the class.

sc A Scanner object used to take user input.


Programme 11
Output:
Enter the size of the matrix: 3

123

894

765

Variable description

Variable Description

n The size of the matrix, input by the user.

matrix The 2D array that represents the matrix.

num The current number being inserted into the matrix.

rowStart, colStart The starting indices for the current spiral layer.

rowEnd, colEnd The ending indices for the current spiral layer.

scanner A Scanner object used to take user input.


Programme 12
Output:
Enter a sentence:

Roses at the top of the pot are red

Sum of gaps in "Roses": 61

Sum of gaps in "at": 19

Sum of gaps in "the": 15

Sum of gaps in "top": 6

Sum of gaps in "of": 9

Sum of gaps in "the": 15

Sum of gaps in "pot": 6

Sum of gaps in "are": 30

Sum of gaps in "red": 14

Total sum of all gaps: 175

Variable description
Variable Description

sentence The sentence input by the user.

totalSumOfGaps
The total sum of the gaps between the ASCII values of consecutive characters
in the entire sentence.

w The starting index of each word in the sentence.

sumOfGaps
The sum of the gaps between the ASCII values of consecutive characters in
each word.

gap The difference between the ASCII values of two consecutive characters.

sc A Scanner object used to take user input.

You might also like