Search

Google
 

Wednesday, January 23, 2008

Write a java program that checks whether a given NUMBER is palindrome or not.

Write a java program that checks whether a given NUMBER is palindrome or not.


import java.io.*;
public class Palindromenumber
{
public static void main(String args[])throws IOException
{
DataInputStream din=new DataInputStream(System.in);
int num,remainder,result=0,n;
System.out.println("Enter the number:");
String s=din.readLine();num = Integer.parseInt(s);
n=num;
while(num>0)
{
remainder = num%10;result = result * 10 + remainder;num = num/10;
}
if(n==result)
{
System.out.println(n+"is palindrome" );
}else
{
System.out.println(n+" is not palindrome" );
}
}
}

Write a java program to display the product of two given matrices

Write a java program to display the product of two given matrices

public class Matrix
{
public static void main(String args[])
{
int a[][] ={{ 1, 2, 5 },{ 3, 4, 4 },{ 5, 6, 2 },};
int b[][] ={{ 7, 8, 9 },{ 1, 2, 3 },{ 4, 9, 5 },};
int c[][] = mult(a, b);
System.out.println("Result: ");
for (int i = 0; i < c.length; ++i)
{
System.out.print("{");
for (int j = 0; j < c.length; ++j)
{
System.out.print(" "+c[j]);
}
System.out.println("}");
}
}

public static int mult(int a[][], int b[][])[][]
{
int rows = a.length;
int cols = b[0].length;
int c[][] = new int[rows][cols];
for (int i = 0; i <>
{
for (int j = 0; j <>
{
c[j] = 0;
for (int k = 0; k <>
{
c[j]= a[k] * b[k][j]+c[j];
}
}
}
return c;
}
}

JAVA Program to check a String for palindrome

//!BjueJ :IDE for icse students!

import java.io.*;
class palindrome
{
public static void main(String arg[])throws IOException
{
DataInputStream in=new DataInputStream(System.in);
int l,i,j,flag=1;
String s;
System.out.println("Enter the string:");
s=in.readLine();
l=s.length();
for(i=0,j=l-1;i<=j;i++,j--)
{
if(s.charAt(i)==s.charAt(j))
{}
else
{
flag=0;
break;
}
}
if(flag==1)
System.out.print(s+" is palindrome");
else
System.out.print(s+" is not palindrome");
}
}

//VISIT http://icse.fairtopic.com for free help

IIT JEE Preparation online Free test websites

Free model test papers and online help for IIT-JEE.

123 IITJEE: IIT JEE Live & Recorded Online Lectures, Tests, eBooks ...
IIT-JEE online course material, test-series and classroom courses.
http://123iitjee.com/

Mathiit Home(Online Course Division) - IIT JEE, AIEEE Online training
Mathiit - IIT JEE, AIEEE, KEEE training institute and Online distance education. The faculty team consists of IITians with decades of experienced providing ...
http://www.mathiit.com/

IIT JEE Courses, Tests, Forums Course Details IIT JEE courses using world class customised courses ... Live & Recorded Online Lectures (Follow Email Instructions for Access); Course ... http://123iitjee.net/ Preparing for IIT-JEE?

Free practice tests Online assesment system
http://www.100percentile.com/

Online IIT-JEE Course
Now IIT-JEE classroom at your HomeRegister now for 10 days free class http://www.mathiit.in/

eGurucool IIT JEE Program IIT JEE is purely a test of fundamentals. And no one understands this better than eGurucool. Precisely why we bring to you the IIT JEE Online Program that ... http://www.egurucool.com/egcnew/iitjee/index.html

Manish's IIT JEE Blog: Online IIT-JEE Test (OETS/OTS) Via Mobile Primarily an IIT JEE blog focusing on Physics, Chemistry, Mathematics, motivation, education systems, exam systems, online courses and more....
http://iitjee.indianetgroup.com/2007/10/online-iit-jee-test-oetsots-via-mobile.html

Mock Test, Online Test Center for CAT, IIT JEE, IAS and BBA exams Mypretest is an online test center that provides online Mock Tests for CAT, IIT JEE, IAS and BBA examination. http://www.mypretest.com/

Crack IIT - Index News & Announcements: Latest news and announcements from the Crack IIT forum staff: 9 Posts www.crackiit.com/

Vision Infinity Ltd. Bhopal Provides exam preparation help for IIT-JEE, AIEEE, CBSE-AIPMT, BHU-PMT, AIIMS.
http://www.visioninfinity.com/

online iit jee cat gre coaching Information on career options, studying abroad, online preparation kit for IIT-JEE, CAT, EAMCET, KCET, TCET, medical entrance.
http://www.login4career.com/

goIIT - IIT JEE - AIEEE Entrance - online test series - online ... GOIIT comes with the intention of bringing you best IIT JEE, AIEEE entrance experts. Find Online test series, mock tests and engineering entrance online ...
http://www.goiit.com/

Welcome to IIT-JEE/AIEEE online tests Our AIEEE & IIT-JEE Online test series with instant score analysis comprises; 20 National Level Integrated Tests(Topic wise syllabus),; 10 National Level ...
http://www.myedupage.com/

IIT JEE,IIT JEE preparation,Coaching IIT JEE online,IIT JEE papers ask-IITians offering online IIT JEE preparation by expert IITians and Coaching IIT jee online for IIT aspirants to crack IIT JEE entrance exam .
http://www.askiitians.com/

goIIT Provide the IIT, JEE, AIEEE, IIIT, CET online help, faq, study material, IIT books, CBSE , ICSE, ISE, ISC, UP Board syllabus and Exams Result,IIT Help, IIT JEE Help, AIEEE Help , IIT JEE study material, Fiitjee and brilliant tutorials, IIT JEE preparation online, FIITJEE test series, U.P Board, CBSE, ICSE, ISE, ISC, West Bengal Board of Secondary Education,Discussion, Community, Free, Online, Tests, Questions, IIT JEE online course, Engg entrance exam, study material, syllabus, FIITJEE and Brilliant tutorials, IIT questions, IIT coaching institute, online free question of IIT, Free AIEEE Tests,india,news,hindi

JAVA icse bluej program Pythagorean triplet

Write a program to input 3 nos. and check whether they are Pythogorean Triplet . or not .The program must display the message accordingly.

some Pythagorean triplets are
( 3, 4, 5)
( 5, 12, 13)
( 7, 24, 25)
( 8, 15, 17)
( 9, 40, 41)
(11, 60, 61)
(12, 35, 37)
(13, 84, 85)
(16, 63, 65)
(20, 21, 29)
(28, 45, 53)
(33, 56, 65)
(36, 77, 85)
(39, 80, 89)
(48, 55, 73)
(65, 72, 97)


u may use them to test the program.

Answer:
//program starts
import java.io.*;
class pytha
{
void main()throws IOException
{
BufferedReader obj=new BufferedReader(new InputStreamReader(System.in));
int a,b,c;
System.out.println("enter no.");
a=Integer.parseInt(obj.readLine());
System.out.println("enter no.");
b=Integer.parseInt(obj.readLine());
System.out.println("enter no.");
c=Integer.parseInt(obj.readLine());
if (a*a==b*b+c*c)
System.out.println("They are Pythogorean Triplet");
else if(b*b==a*a+c*c)
System.out.println("They are Pythogorean Triplet ");
else if(c*c==a*a+b*b)
System.out.println("They are Pythogorean Triplet a² + b² = c² ");
else
System.out.println("Test Failed !!! They are Non Pythogorean Triplet ");
}
}
//if u want to consider a² + b² = c² only then remove first 2 conditions

JAVA program for icse students

A library charges a fine for books returned late following are the charges for fine:--
First 5 Days:- 40 paise / day
6-10 days :- 60 paise /day
above 10 days:- 1 rupee /day

do with buffer reader..

import java.io.*;
class buff
{
void main()throws IOException
{
BufferedReader obj=new BufferedReader(new InputStreamReader(System.in));
System.out.println("enter no. of days");
int a;
a=Integer.parseInt(obj.readLine());
double ans=0;
if (a<=5)
ans=a*.4;
else if(a<=10)
ans= 2 + ((a-5)*.6);
else
ans= 2 + 3 + a-10;
System.out.println("Fine:"+ans);
}
}

Ask JAVA related questions at http://icse.fairtopic.com

JAVA ICSE BLUEJ program

Series question

WAP to print the series:-S = 1+(1+2)+(1+2+3)+ --------+(1+2+3--------+n)

//SUPPLY N AS PARAMETER URSELF
class series2
{
void main(int n)
{
int S=0;
for (int c=1;c<=n;c++)
{for (int d=1;d<=c;d++)
{
S=S+d;
}
}
System.out.println(S);
}
}