java programe
1)write a prgrame to idetify common elements r number between two given arrays , you should not use any inbuild java method are list to find common values.
2)you have got a range of number 1 to n where one of the number is repeated,
3) write a prgrame to print fibonaccis series with and without recursive approach
output - 0 ,1,1 , 2, 3 ,5, 8 13, 21, 34, 55, 89, 144, 233,377
4) write a prgrame to reverse a number?
View Answers
August 25, 2012 at 11:45 AM
Here is an example that compares two array and display the common elements between them.
public class FindCommonElement {
public static void main(String args[]) {
int[] arr1 = {1,2,3,4,5};
int[] arr2 = {3,4,12,9,40,32,2};
for(int i=0;i<arr1.length;i++){
for(int j=0;j<arr2.length;j++){
if(arr1[i]==arr2[j]){
System.out.println(arr1[i]);
}
}
}
}
}
August 25, 2012 at 12:12 PM
Here is an example of Fibonacci Series without recursive approach.
public class Fibbonacci {
public static void main(String[] args) throws Exception {
int num = 15;
long[] series = new long[num];
series[0] = 0;
series[1] = 1;
for(int i=2; i < num; i++){
series[i] = series[i-1] + series[i-2];
}
System.out.println("Fibonacci Series upto " + num);
for(int i=0; i< num; i++){
System.out.print(series[i] + " ");
}
}
}
August 25, 2012 at 12:15 PM
Here is an example of reversing number where user is allowed to enter the number which is to be reversed.
import java.io.*;
class ReverseNumber
{
public static void main(String[] args) throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter Number");
int num= Integer.parseInt(br.readLine());
int n=num;
int rem=0;
int rev=0;
while(n!=0)
{
rem = n%10;
rev = rev*10+rem;
n=n/10;
}
System.out.println("Reverse Number : " + rev);
}
}
Ads
Related Tutorials/Questions & Answers:
java programe
java programe 1)write a prgrame to idetify common elements r number between two given arrays , you should not use any inbuild
java method are list to find common values.
2)you have got a range of number 1 to n where one
ArrayList programe
ArrayList programe How to write a
java program to accept an array list of Employee objects. search,delete and modify a particular Employee based on Id Number (like ID,Name&Address
Advertisements
jsp programe for displaying data from database
jsp
programe for displaying data from database i am using JSP.i want to insert data into database and also want to display the things i have entered...;/body>
</html>
2)emp.jsp:
<%@page language="
java" import ="java.sql.
jsp programe for displaying data from database
jsp
programe for displaying data from database i am using JSP.i want to insert data into database and also want to display the things i have entered...;/body>
</html>
2)emp.jsp:
<%@page language="
java" import ="java.sql.
jsp programe for displaying data from database
jsp
programe for displaying data from database i am using JSP.i want to insert data into database and also want to display the things i have entered...;/body>
</html>
2)emp.jsp:
<%@page language="
java" import ="java.sql.
java applet notpad
java applet notpad i need Codes Or
programe in
java applet ; i want add this
programe to my site html > please help me our
Learn
Java Applets, if you want to learn
java applets then please visit the following link
java
java tcp/ip client and server
programe
java
java how use in
programe getApplet(String name
java beginers
java beginers 1)i have method that is publis static insert(map p... public static insert(map p), what code need to write., how can write a
programe... a
programe for it.
3)i have array that is object[] obj= { new string("hi"), new
java programme
java programme i have to write a
java programe that calculates the average of 10 students in Test 1 ,Test 2 and Test 3....Values of the marks in all the test for a student should be hardcore.Ialso have to tell the maixmum
Very new to Java
Very new to
Java hi I am pretty new to
java and am wanting to create a
programe for the rhyme 10 green bottles.
10 green bottles standing on the wall
10 green bottles standing on the wall
and if 1 green bottle should
java
java write a
programe to create command like dir,copy,rename,md,type,copycon,delete.
Hello Friend,
Please clarify your problem.
Thanks
programs in java
programs in java . I need an application for managing an educational institute.
That application should provide the details of
Students
Courses
Faculty
Fee details
etc..,
pl z guide me how to write these
programe
operating system
operating system write a
programe in
java that print system information like which process are in running state and those process used which resourses
Editor
Editor sir
i want to develop a menu
programe in
java so sir i want to a file menu which have open dialog and save dialog and in edit menu have find option
java developer
java developer i didnt get the correct ANSWER PLZ EXECUTE THE FOOLWING SERVLET BY USING DATABASE USERLOGIN TABLE VALUES.
//validate login.html... and password through database.
My idea is to write the
programe whenever user want
arraylist
arraylist Using arraylist class , what type of exception are throws, how can write a
java programe
An ArrayList can throw ArrayIndexOutOfBoundsException. Here is a example.
import java.util.*;
public class
util
util Write a
programe such as whenever any user enter the name of a country it displays the current date and time and ist also
thread
thread Hi
what are the threads required to excute a
programe except main threads?
Thanks
kalins naik
jdbc
jdbc is it possible to use doget & dopost method with jdbc to call in a servlet
programe
404 error
404 error i have 404 error in my addition
programe of servlet how should i solve this.
i'm using netbean on glassfish server
404 error
404 error i have 404 error in my addition
programe of servlet how should i solve this.
i'm using netbean on glassfish server
java
java diff bt core
java and
java
JAVA
JAVA how the name came for
java language as "
JAVA