Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
14Activity
0 of .
Results for:
No results containing your search query
P. 1
Java Lab Assignment Solution 5th sem

Java Lab Assignment Solution 5th sem

Ratings: (0)|Views: 2,703|Likes:
Published by Baidyanath Dutta
this is NSEC Java lab assignment solved paper
this is NSEC Java lab assignment solved paper

More info:

Published by: Baidyanath Dutta on Nov 10, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOCX, PDF, TXT or read online from Scribd
See more
See less

02/12/2015

pdf

text

original

 
 
NAME:-YEAR:-CLASS R.NO.:-UNIVERSITY R.NO.:-
 
 
//1.a)prime number between range
 
public class as1a{public static void main(String[] args){int i,j,r;r=Integer.parseInt(args[0]);for(i=2;i<=r;i++){for(j=2;j<=i;j++){if(i%j==0)break;}if(i==j)System.out.print(" " +i + " ");}}}/*Output:java as1a 252 3 5 7 11 13 17 19 23*/
 
//1.b)check whether a string is palindrome or notimport java.io.*;public class as1b{public static void main(String args[])throws IOException{char c[]=new char[20];char b[]=new char[20];int a;int n;String s;boolean ispalindrome=true;System.out.println("enter the STRING");BufferedReader br=new BufferedReader(newInputStreamReader(System.in));s=br.readLine();c=s.toCharArray();n=s.length();for(int i=n-1;i>=0;i-- ){b[n-i-1]=c[i];}for(int i=0;i<n;i++){if(b[i]!=c[i]){System.out.println(" Not Palindrome");ispalindrome=false;break;}}if(ispalindrome)System.out.println("It is Palindrome");}}/*output:enter the STRINGabbaIt is Palindrome*/

Activity (14)

You've already reviewed this. Edit your review.
Varsha Dwivedi liked this
Kiran Kumar liked this
1 hundred reads
1 thousand reads
bhushaninje liked this
zlamdunk liked this
Athirah Hazwani liked this
Natarajan Balaji liked this
Tiancheng Zhuang liked this
Armin Suljovic liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->