0% found this document useful (0 votes)
3 views65 pages

Java Record Final

The document is a laboratory record for the Computational Thinking and Problem Solving course at Sri Shakthi Institute of Engineering and Technology. It includes a list of experiments with aims, algorithms, and results for various programming tasks in Java, covering topics such as arithmetic operations, conditional statements, loops, arrays, and strings. Each experiment is structured with a clear aim and algorithm, confirming successful execution and output verification.

Uploaded by

esubramaniancse
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)
3 views65 pages

Java Record Final

The document is a laboratory record for the Computational Thinking and Problem Solving course at Sri Shakthi Institute of Engineering and Technology. It includes a list of experiments with aims, algorithms, and results for various programming tasks in Java, covering topics such as arithmetic operations, conditional statements, loops, arrays, and strings. Each experiment is structured with a clear aim and algorithm, confirming successful execution and output verification.

Uploaded by

esubramaniancse
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

SRI SHAKTHI

INSTITUTE OF ENGINEERING AND TECHNOLOGY


COIMBATORE - 641062
(An Autonomous Institution)

25CSE111 – Computational Thinking and Problem Solving


Laboratory

DEPARTMENT OF
COMPUTER SCIENCE AND ENGINEERING
SRI SHAKTHI
INSTITUTE OF ENGINEERING AND TECHNOLOGY
COIMBATORE – 62
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
25CSE111 – Computational Thinking and Problem Solving
Laboratory
LABORATORY RECORD

NAME: ……………………………....... REG NO: …………………….

CLASS: …………………………........... BRANCH: .……………………

ACADEMIC YEAR: ………………… BATCH: ……….… SEMESTER: ………

Certified and Bonafide record of work done by ……….………….………


Place:
Date:

Staff In-Charge Head of the Department

University Register Number ………………………………………...


Submitted for the University Practical Examination held on ……...…….

INTERNAL EXAMINER EXTERNAL EXAMINER


INDEX

Exp NO Date Name of the Program Marks Signature


Basic Programs
1 03.09.25 Arithmetic operations
2 03.09.25 Area of rectangle
3 10.09.25 Read and Print a number
4 10.09.25 Addition of two numbers
5 17.09.25 Bitwise operators
6 17.09.25 Read and Print Character
7 24.09.25 Read and Print customer's data
8 24.09.25 Divide number using shift operator
Conditional Statements
9 04.10.25 Student Grade
10 04.10.25 Greatest of 3 numbers
Check if character is
11 08.10.25 uppercase,lowercase,number
12 08.10.25 Odd or even number
Loops
13 15.10.25 Read and print number from 1 to N
14 15.10.25 Sum of all odd numbers
15 22.10.25 Skip all number's divisible by 5 and 7
16 22.10.25 Prime or not
17 29.10.25 Print from high to low ignoring num
18 29.10.25 Print alphabets from A to Z
19 05.11.25 Factorial of a number
Arrays
20 05.11.25 Display alternate number's in an array
21 08.11.25 Add corresponding elements of 2 list
22 08.11.25 First common element in an array
23 12.11.25 Addition and Subtraction of 2D matrix
24 19.11.25 Transpose of Matrix
Strings
25 26.11.25 Length of string
Read a string and Convert it to
26 03.12.25 uppercase
27 10.12.25 Two strings are equal or not
28 17.12.25 String is palindrome or not
29 24.12.25 Highest Frequency word
30 31.12.25 Happy Strings
EX NO: 1
ARITHMETIC OPERATIONS
DATE:

AIM:
To perform arithmetic operations using java

ALGORITHM:
Step 1: Start
Step 2: Read two numbers a and b
Step 3: Perform addition → sum = a + b
Step 4: Perform subtraction → diff = a - b
Step 5: Perform multiplication → prod = a * b
Step 6: Perform division → quot = a / b
Step 7: Perform modulus → rem = a % b
Step 8: Display all results
Step 9: Stop

CLASS PERFORMANCE
RECORD
VIVA
TOTAL

RESULT:
Thus the program is executed successfully and the output is verified
EX NO: 2
AREA OF RECTANGLE
DATE:

AIM:
To find area of rectangle using java

ALGORITHM:
Step 1: Start
Step 2: Read the value of length (l)
Step 3: Read the value of breadth (b)
Step 4: Calculate area → area = l × b
Step 5: Display the area
Step 6: Stop

CLASS PERFORMANCE
RECORD
VIVA
TOTAL

RESULT:
Thus the program is executed successfully and the output is verified
EX NO: 3
READ AND PRINT A NUMBER
DATE:

AIM:
To read and print a number using java

ALGORITHM:
Step 1: Start
Step 2: Import [Link] package
Step 3: Declare an integer variable n
Step 4: Create a Scanner object to read input
Step 5: Read the value of n from the user
Step 6: Display the value of n
Step 7: Stop

CLASS PERFORMANCE
RECORD
VIVA
TOTAL

RESULT:
Thus the program is executed successfully and the output is verified
EX NO: 4
ADDITION OF TWO NUMBERS
DATE:

AIM:
To perform addition of two numbers using java

ALGORITHM:
Step 1: Start
Step 2: Import [Link] package
Step 3: Declare three integer variables a, b, and sum
Step 4: Create a Scanner object to read input
Step 5: Read values of a and b from the user
Step 6: Calculate sum = a + b
Step 7: Display the result
Step 8: Stop

CLASS PERFORMANCE
RECORD
VIVA
TOTAL

RESULT:
Thus the program is executed successfully and the output is verified
EX NO: 5
BITWISE OPERATORS
DATE:

AIM:
To perform bitwise operations on two numbers using a Java program.

ALGORITHM:
Step 1: Start
Step 2: Import [Link]
Step 3: Declare integer variables a and b
Step 4: Read values of a and b
Step 5: Perform bitwise AND (a & b)
Step 6: Perform bitwise OR (a | b)
Step 7: Perform bitwise XOR (a ^ b)
Step 8: Perform bitwise NOT (~a)
Step 9: Perform left shift (a << 1)
Step 10: Perform right shift (a >> 1)
Step 11: Display all results
Step 12: Stop

CLASS PERFORMANCE
RECORD
VIVA
TOTAL

RESULT:
Thus the program is executed successfully and the output is verified
EX NO: 6
READ AND PRINT CHARACTER
DATE:

AIM:
To read a character from the user and display the same character using a
Java program.

ALGORITHM:
Step 1: Start
Step 2: Import [Link] package
Step 3: Declare a character variable ch
Step 4: Create a Scanner object
Step 5: Read a character from the user
Step 6: Display the character
Step 7: Stop

CLASS PERFORMANCE
RECORD
VIVA
TOTAL

RESULT:
Thus the program is executed successfully and the output is verified
EX NO: 7
READ AND PRINT CUSTOMER'S DATA
DATE:

AIM:
To read and print customer data using a Java program.

ALGORITHM:
Step 1: Start
Step 2: Import [Link] package
Step 3: Declare variables for customer name, age, and phone number
Step 4: Create a Scanner object
Step 5: Read customer name
Step 6: Read customer age
Step 7: Read customer phone number
Step 8: Display all customer details
Step 9: Stop

CLASS PERFORMANCE
RECORD
VIVA
TOTAL

RESULT:
Thus the program is executed successfully and the output is verified
EX NO: 8
DIVIDE NUMBER USING SHIFT OPERATOR
DATE:

AIM:
To divide a given number by 2 using the right shift (>>) operator in Java.

ALGORITHM:
Step 1: Start
Step 2: Import [Link]
Step 3: Declare integer variable n
Step 4: Read the value of n
Step 5: Divide the number using right shift (n >> 1)
Step 6: Store the result
Step 7: Display the result
Step 8: Stop

CLASS PERFORMANCE
RECORD
VIVA
TOTAL

RESULT:
Thus the program is executed successfully and the output is verified
EX NO: 9
STUDENT GRADE
DATE:

AIM:
To read student marks and display the grade using if-else conditional
statements in Java.

ALGORITHM:
Step 1: Start
Step 2: Import [Link]
Step 3: Declare integer variable marks
Step 4: Read marks from the user
Step 5: Check conditions using if-else statements
Step 6: Display the corresponding grade
Step 7: Stop

CLASS PERFORMANCE
RECORD
VIVA
TOTAL

RESULT:
Thus the program is executed successfully and the output is verified
EX NO: 10
GREATEST OF 3 NUMBERS
DATE:

AIM:
To read three numbers from the user and find the greatest number using
conditional statements in Java.

ALGORITHM:
Step 1: Start
Step 2: Import [Link]
Step 3: Declare three integer variables a, b, and c
Step 4: Read values of a, b, and c
Step 5: Compare the numbers using if-else conditions
Step 6: Display the greatest number
Step 7: Stop

CLASS PERFORMANCE
RECORD
VIVA
TOTAL

RESULT:
Thus the program is executed successfully and the output is verified
EX NO: 11

DATE: CHECK IF CHARACTER IS


UPPERCASE,LOWERCASE,NUMBER

AIM:
To read a character from the user and determine whether it is uppercase,
lowercase, or a digit using if-else conditional statements in Java.

ALGORITHM:
Step 1: Start
Step 2: Import [Link]
Step 3: Declare a character variable ch
Step 4: Read the character from the user
Step 5: Check if ch is between 'A' and 'Z'
Step 6: Else check if ch is between 'a' and 'z'
Step 7: Else check if ch is between '0' and '9'
Step 8: Display the result
Step 9: Stop

CLASS PERFORMANCE
RECORD
VIVA
TOTAL

RESULT:
Thus the program is executed successfully and the output is verified
EX NO: 12

DATE: ODD OR EVEN NUMBER

AIM:
To read a number from the user and determine whether it is odd or even
using Java.

ALGORITHM:
Step 1: Start
Step 2: Import [Link]
Step 3: Declare an integer variable n
Step 4: Read the value of n
Step 5: Check if n % 2 == 0
Step 6: If true, print Even
Step 7: Else, print Odd
Step 8: Stop

CLASS PERFORMANCE
RECORD
VIVA
TOTAL

RESULT:
Thus the program is executed successfully and the output is verified
EX NO: 13
READ AND PRINT NUMBER FROM 1 TO N
DATE:

AIM:
To read a number N and print numbers from 1 to N using a loop in Java.

ALGORITHM:
Step 1: Start
Step 2: Import [Link]
Step 3: Declare integer variable N
Step 4: Read the value of N
Step 5: Initialize loop variable i = 1
Step 6: Repeat while i ≤ N
Step 7: Print value of i
Step 8: Increment i
Step 9: Stop

CLASS PERFORMANCE
RECORD
VIVA
TOTAL

RESULT:
Thus the program is executed successfully and the output is verified
EX NO: 14
SUM OF ALL ODD NUMBERS
DATE:

AIM:
To read a number N and calculate the sum of all odd numbers from 1 to N
using a loop in Java.

ALGORITHM:
Step 1: Start
Step 2: Import [Link]
Step 3: Declare integer variables N, i, and sum = 0
Step 4: Read the value of N
Step 5: Initialize i = 1
Step 6: Repeat while i ≤ N
Step 7: If i is odd, add it to sum
Step 8: Increment i
Step 9: Display the value of sum
Step 10: Stop

CLASS PERFORMANCE
RECORD
VIVA
TOTAL

RESULT:
Thus the program is executed successfully and the output is verified
EX NO: 15
SKIP ALL NUMBER'S DIVISIBLE BY 5 AND 7
DATE:

AIM:
To read a number N and print numbers from 1 to N, skipping numbers
divisible by both 5 and 7, using loops in Java.

ALGORITHM:
Step 1: Start
Step 2: Import [Link]
Step 3: Declare integer variable N
Step 4: Read the value of N
Step 5: Initialize loop variable i = 1
Step 6: Repeat while i ≤ N
Step 7: If i is divisible by both 5 and 7, skip it
Step 8: Otherwise, print i
Step 9: Increment i
Step 10: Stop

CLASS PERFORMANCE
RECORD
VIVA
TOTAL

RESULT:
Thus the program is executed successfully and the output is verified
EX NO: 16
PRIME OR NOT
DATE:

AIM:
To read a number from the user and check whether it is prime or not using
loops in Java.

ALGORITHM:
Step 1: Start
Step 2: Import [Link]
Step 3: Declare integer variables n, i, and count = 0
Step 4: Read the value of n
Step 5: If n <= 1, print Not Prime and stop
Step 6: Initialize loop from i = 2 to i <= n / 2
Step 7: If n % i == 0, increment count
Step 8: After loop, if count == 0, print Prime
Step 9: Else, print Not Prime
Step 10: Stop

CLASS PERFORMANCE
RECORD
VIVA
TOTAL

RESULT:
Thus the program is executed successfully and the output is verified
EX NO: 17
PRINT FROM HIGH TO LOW IGNORING NUM
DATE:

AIM:
To read a starting number (high), an ending number (low), and an ignore
number, then print numbers from high to low, skipping the given number using
loops in Java.

ALGORITHM:
Step 1: Start
Step 2: Import [Link]
Step 3: Declare integer variables high, low, and skip
Step 4: Read values of high, low, and skip
Step 5: Initialize loop variable i = high
Step 6: Repeat while i ≥ low
Step 7: If i == skip, skip the number
Step 8: Otherwise, print i
Step 9: Decrement i
Step 10: Stop

CLASS PERFORMANCE
RECORD
VIVA
TOTAL

RESULT:
Thus the program is executed successfully and the output is verified
EX NO: 18
PRINT ALPHABETS FROM A TO Z
DATE:

AIM:
To print uppercase alphabets from A to Z using a loop in Java.

ALGORITHM:
Step 1: Start
Step 2: Declare a character variable ch
Step 3: Initialize ch = 'A'
Step 4: Repeat while ch <= 'Z'
Step 5: Print the value of ch
Step 6: Increment ch
Step 7: Stop

CLASS PERFORMANCE
RECORD
VIVA
TOTAL

RESULT:
Thus the program is executed successfully and the output is verified
EX NO: 19
FACTORIAL OF A NUMBER
DATE:

AIM:
To read a number from the user and calculate its factorial using loops in
Java.

ALGORITHM:
Step 1: Start
Step 2: Import [Link]
Step 3: Declare integer variables n and fact = 1
Step 4: Read the value of n
Step 5: Repeat loop from i = 1 to i ≤ n
Step 6: Multiply fact = fact × i
Step 7: Display the factorial value
Step 8: Stop

CLASS PERFORMANCE
RECORD
VIVA
TOTAL

RESULT:
Thus the program is executed successfully and the output is verified
EX NO: 20
DISPLAY ALTERNATE NUMBER'S IN AN ARRAY
DATE:

AIM:
To read elements into an array and display alternate elements (every
second element) using arrays in Java.

ALGORITHM:
Step 1: Start
Step 2: Import [Link]
Step 3: Declare integer variable n
Step 4: Declare integer array arr[] of size n
Step 5: Read n array elements
Step 6: Initialize loop from index 0 to n-1 with increment +2
Step 7: Print array element at current index
Step 8: Stop

CLASS PERFORMANCE
RECORD
VIVA
TOTAL

RESULT:
Thus the program is executed successfully and the output is verified
EX NO: 21
ADD CORRESPONDING ELEMENTS OF 2 LIST
DATE:

AIM:
To read two lists (arrays) of equal size and add their corresponding
elements using Java.

ALGORITHM:
Step 1: Start
Step 2: Import [Link]
Step 3: Declare integer variable n
Step 4: Declare three integer arrays a[], b[], and c[] of size n
Step 5: Read elements of first array a[]
Step 6: Read elements of second array b[]
Step 7: Use a loop to add corresponding elements
Step 8: Store result in array c[]
Step 9: Display elements of c[]
Step 10: Stop

CLASS PERFORMANCE
RECORD
VIVA
TOTAL

RESULT:
Thus the program is executed successfully and the output is verified
EX NO: 22
FIRST COMMON ELEMENT IN AN ARRAY
DATE:

AIM:
To read elements into an array and find the first common (repeated)
element using loops in Java.

ALGORITHM:
Step 1: Start
Step 2: Import [Link]
Step 3: Declare integer variable n
Step 4: Declare integer array arr[] of size n
Step 5: Read array elements
Step 6: For i = 0 to n-1
Step 7: For j = i + 1 to n-1
Step 8: If arr[i] == arr[j], print arr[i] and stop
Step 9: If no common element found, print message
Step 10: Stop

CLASS PERFORMANCE
RECORD
VIVA
TOTAL

RESULT:
Thus the program is executed successfully and the output is verified
EX NO: 23
ADDITION AND SUBTRACTION OF 2D MATRIX
DATE:

AIM:
To perform addition and subtraction of two 2D matrices using Java .

ALGORITHM:
Step 1: Start
Step 2: Import [Link]
Step 3: Read number of rows r and columns c
Step 4: Declare two matrices A[r][c] and B[r][c]
Step 5: Declare result matrices Sum[r][c] and Diff[r][c]
Step 6: Read elements of matrix A
Step 7: Read elements of matrix B
Step 8: Add corresponding elements → Sum[i][j] = A[i][j] + B[i][j]
Step 9: Subtract corresponding elements → Diff[i][j] = A[i][j] -
B[i][j]
Step 10: Display result matrices
Step 11: Stop

CLASS PERFORMANCE
RECORD
VIVA
TOTAL

RESULT:
Thus the program is executed successfully and the output is verified
EX NO: 24
TRANSPOSE OF MATRIX
DATE:

AIM:
To find the transpose of a given matrix using 2D arrays in Java .

ALGORITHM:
Step 1: Start
Step 2: Import [Link]
Step 3: Read number of rows r and columns c
Step 4: Declare matrix A[r][c]
Step 5: Declare transpose matrix T[c][r]
Step 6: Read elements of matrix A
Step 7: For each element, assign T[j][i] = A[i][j]
Step 8: Display transpose matrix
Step 9: Stop

CLASS PERFORMANCE
RECORD
VIVA
TOTAL

RESULT:
Thus the program is executed successfully and the output is verified
EX NO: 25
LENGTH OF STRING
DATE:

AIM:
To read a string from the user and find its length using Java.

ALGORITHM:
Step 1: Start
Step 2: Import [Link]
Step 3: Declare a string variable str
Step 4: Read the string from the user
Step 5: Find the length using [Link]()
Step 6: Display the length
Step 7: Stop

CLASS PERFORMANCE
RECORD
VIVA
TOTAL

RESULT:
Thus the program is executed successfully and the output is verified
EX NO: 26
READ A STRING AND CONVERT IT TO UPPERCASE
DATE:

AIM:
To read a string from the user and convert it to uppercase using Java.

ALGORITHM:
Step 1: Start
Step 2: Import [Link]
Step 3: Declare a string variable str
Step 4: Read the string from the user
Step 5: Convert the string to uppercase using toUpperCase()
Step 6: Display the uppercase string
Step 7: Stop

CLASS PERFORMANCE
RECORD
VIVA
TOTAL

RESULT:
Thus the program is executed successfully and the output is verified
EX NO: 27
TWO STRINGS ARE EQUAL OR NOT
DATE:

AIM:
To read two strings from the user and check whether they are equal or not
using Java.

ALGORITHM:
Step 1: Start
Step 2: Import [Link]
Step 3: Declare two string variables str1 and str2
Step 4: Read the first string
Step 5: Read the second string
Step 6: Compare the strings using equals() method
Step 7: If equal, print “Strings are Equal”
Step 8: Else, print “Strings are Not Equal”
Step 9: Stop

CLASS PERFORMANCE
RECORD
VIVA
TOTAL

RESULT:
Thus the program is executed successfully and the output is verified
EX NO: 28
STRING IS PALINDROME OR NOT
DATE:

AIM:
To read a string from the user and check whether it is a palindrome or not
using Java.

ALGORITHM:
Step 1: Start
Step 2: Import [Link]
Step 3: Declare string variables str and rev
Step 4: Read the string from the user
Step 5: Initialize rev as empty string
Step 6: Reverse the string using a loop
Step 7: Compare str and rev using equals()
Step 8: If equal, print Palindrome
Step 9: Else, print Not Palindrome
Step 10: Stop

CLASS PERFORMANCE
RECORD
VIVA
TOTAL

RESULT:
Thus the program is executed successfully and the output is verified
EX NO: 29
HIGHEST FREQUENCY WORD
DATE:

AIM:
To read a sentence from the user and find the word with the highest
frequency using Java.

ALGORITHM:
Step 1: Start
Step 2: Import [Link]
Step 3: Declare string variable str
Step 4: Read the sentence
Step 5: Convert string to lowercase
Step 6: Split the sentence into words using split()
Step 7: Initialize variables maxCount and maxWord
Step 8: Use nested loops to count frequency of each word
Step 9: Update maxCount and maxWord if higher frequency found
Step 10: Display highest frequency word
Step 11: Stop

CLASS PERFORMANCE
RECORD
VIVA
TOTAL

RESULT:
Thus the program is executed successfully and the output is verified
EX NO: 30
HAPPY STRINGS
DATE:

AIM:
To read a string and check whether it is a Happy String based on even
occurrence of vowels using Java.

ALGORITHM:
Step 1: Start
Step 2: Import [Link]
Step 3: Declare string variable str
Step 4: Read the string from the user
Step 5: Convert string to lowercase
Step 6: Initialize counters for vowels a, e, i, o, u
Step 7: Traverse the string using a loop
Step 8: Increment corresponding vowel count
Step 9: Check if all vowel counts are even
Step 10: If true, print Happy String
Step 11: Else, print Not Happy String
Step 12: Stop

CLASS PERFORMANCE
RECORD
VIVA
TOTAL

RESULT:
Thus the program is executed successfully and the output is verified

You might also like