Abhi Java1.4

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

DEPARTMENT OF

COMPUTER SCIENCE & ENGINEERING


Experiment No:1.4

Student Name:Abhinov Kumar Roy UID: 21BCS9952


Branch: BE-CSE Section/Group: 802 ’B’
Semester: 3rd semester Subject Code:21BCS-218
Subject Name: JAVA
Date of Performance: 09-09-2022

Aim of the practical:


Given a String A, print yes if it is a palindrome, print no otherwise.

Program Code:
import java.io.*;
import java.util.*;

public class Solution {

public static void main(String[] args) {

Scanner sc=new Scanner(System.in);


String A=sc.next();
String R=new StringBuilder(A).reverse().toString();

if(A.equals(R)){
System.out.println("Yes");
}
else{
System.out.println("No");
}

}
}
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

Output:

Learning outcomes (What I have learnt):


1. Learned to use string builder

2. Learned about palindrome number

3. Learned to reverse a string


Evaluation Grid :
Sr. No. Parameters Marks Obtained Maximum Marks
1. Student Performance 12
(Conduct of experiment)
objectives/Outcomes.
2. Viva Voce 10
3. Submission of Work Sheet 8
(Record)
Total 30

You might also like