al ajmi hassan
help me 2
1 Answer(s)      a year and 11 months ago
Posted in : Java Beginners

write java program to enter five numbers and will determine the location of the number

sample output:

ENTER 5 NUMBERS: 1 2 3 4 5 ENTER NUMBER TO SEARCH:1{press enter} 1 found in index 0

View Answers

June 15, 2011 at 11:15 AM


import java.util.*;
class  ArrayExample
{
    public static void main(String[] args) 
    {
     Scanner input=new Scanner(System.in);
     int array[]=new int[5];
     System.out.println("Enter Array Elements: ");
     for(int i=0;i<array.length;i++){
         array[i]=input.nextInt();
     }
     System.out.println("Enter number to search: ");
     int number=input.nextInt();
     System.out.println("Its index is: ");

     for(int i=0;i<array.length;i++){
         if(array[i]==number){
             System.out.print(i);
         }
     }
    }
}









Related Pages:
help me 2
help me 2  write java program to enter five numbers and will determine the location of the number sample output: ENTER 5 NUMBERS: 1 2 3 4 5 ENTER NUMBER TO SEARCH:1{press enter} 1 found in index 0   import
help me
help me  HI. Please help me for doing project. i want to send control from one jsp page to 2 jsp pages... is it possible? if possible how to do
help me
help me  I have a quastion a bout array whic is>>> 1-write aprogram to diplay a multiplication table for 1to 10 by entering the start... the result will be 1 2 3 4 5 6 7 8 9 10 2 4 6 8 10 12 14 16 18 20 3 6 9 12 15 18 21 24
help me..
help me..  Design and write a class named Person and its two subclasses named Student and Employee. Make Lecturer and Admin subclasses of Employee... a matric number and status (year 1, year 2 or year 3). An employee has a department
help me
help me  Create a GUI application that allows a user to select a text file (using the JFileChooser). The program will then allow the user to do... appropriate buttons or selecting from menu): 1) display the contents of the file 2
Help me
Help me  HI I am using Tomcat6.0 this is the problem i got wen i run the code java.lang.NullPointerException org.apache.jsp.loginjsp.jspInit...="Submit"></td></tr> </table> </form> </html> 2
Help me
Help me  HI I am using Tomcat6.0 this is the problem i got wen i run the code , i am using login.html ,login .jsp,login.java and web.xml code...="Submit"></td></tr> </table> </form> </html> 2
please help me...
please help me...  write an application that print number in the following order using a FOR-Loop 1 2 3 4 5 2 4 6 8 10 3 6 9 1215 4 8 121620 5 10152025
plzzz help me!!
plzzz help me!!  . Write a program to display a multiplication table... number: 1 Enter end number: 2 {press enter} 1 2 3 4 5 6 7 8 9 10 1 1 2 3 4 5 6 7 8 9 1 2 2 4 6 8 10 12 14 16 18 20
plaz help me i try to compile from last 2 day .
plaz help me i try to compile from last 2 day .   org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 34 in the jsp file: /saveUpdate.jsp name cannot be resolved to a variable 31
plaz help me i try to compile from last 2 day .
plaz help me i try to compile from last 2 day .   org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 34 in the jsp file: /saveUpdate.jsp name cannot be resolved to a variable 31
Help me plzz
Help me plzz  Hello Roseindia.... I need ur help urgently... I am... project not web project so kindly provide me a help.... It will be good for me if u provide me all required files like; strtus.xml web.xml 2 Jsp pages thnx
help me in answering this
help me in answering this  hi assume there are 3jsps in 1.jsp i create a session add somthin to it lyk HttpSession hs = request.getSession(true... is not dead ... I am executing jsps in order 1 2 nd 3... Actually wen i exec
Can someone help me with this?
Can someone help me with this?  I have this project and i dont know how to do it. Can someone help me? please? Write a java class named "PAMA..., Multiply, Divide) Help me please! Thanks in advance!   import
Please help me
Please help me  Hi Sir, please send me the code for the following...} set2={15,25,35} output: union={10,15,20,25,30,35,40} 2) input: "Hi what... is: "+l); } } 2) import java.util.*; class ReverseWords{ public static void
Please help me??
Please help me??  Question_1: Using one-dimension array of primitive... elements. Instructions: 1. Create a new file ArrayDemo.java 2. Declare... to have 8 elements as follows:2, 3, 5, 7, 11, 13, 17, and 19 4. Display
help me to solve this question
help me to solve this question   A user needs to key in data... 2009/2010 1 STIW3023 Database 2010/2011 2 b. Course code ââ?¬â... 2010/2011 2 c. Session and semester ââ?¬â?? The system
help me - Java Beginners
into 2 decimal places sample 1.25) Mexican_________ guys help me..thank...help me  helo guys can you share me a code about Currency Conversion.Money will convert according to the type of currency.would you help me please
Plz Help Me
Plz Help Me  Write a program for traffic light tool to manage time... traffic light on the frame. We have used java swing. It may help you. import...().setLayout(new GridLayout(2, 1)); b1 = new JButton("Red"); b2 = new
help me in solving this error
help me in solving this error  Hello, i have installed tomcat 6.0, i am getting following error while running application...;/tr> </table> </form> </html> 2)Login1.java: import
help me - Java Beginners
help me   i want to create a login form in java with jdbc connection in ist form there will two label for passworrd and user name and two button...); } }   continue.... 2)CreateAccount.java: import javax.swing.
Help me please!!! - Java Beginners
Help me please!!!  im badly needing the complete code for this project in java!!! can you please help me???!!! it is about 1-dimensional array... the answers 8Hours from now!!! Kindly help me!! please!!please!!! NOTE
please help me - Java Beginners
please help me   I have some error in this programe //write...[]) { for( int a=1;b=2 ; i++) a=a+2; b=b-2; System.out.print... b=2; for(int i=100;i>0;i--){ System.out.print(a); System.out.print
Help
Help  Hi; Can anyone help me to solve this errors. I use J2ME...: class IconsCanvas menu = new SlideMenu(new String[]{"1", "2", "3", "4", ^ 2 errors com.sun.kvem.ktools.ExecutionException Build failed
help me in disabling checked checkboxes
as enabled. I have stuck this problem from last 2 days....so please, help me out. Thank you for your help in advance...help me in disabling checked checkboxes  <%@ page language="java
Can you help me with applet?
Can you help me with applet?  I'm very new to applet, and i'm weak in graphic design part. How can i add the graphic in my test project? Can you help me with this: import java.io.*; import java.util.*; import javax.swing.
Help Me in My Java Work
Help Me in My Java Work  Can you help me please... Write a Java...¢â?¬Â? or ââ?¬Å?-1ââ?¬Â? to exit: 89 Total number of marks entered so far: 2...?-1ââ?¬Â? to exit: -1 Total number of marks entered: 2. GPA = 3.75. Application
help me in these - Java Interview Questions
help me in these  hello every body i have some question if you cam plz answer me it is important to me and these are the questions : 1)Write... as length of that word?? 2) Write a program that asks the user for two words
help me
help me  i have done as u directed but nothing happens gud to me..... . i am using netbeans is that matter at all help me and take me out from trouble where to store jfree api to use it for j2ee based project
help me
help me  please send me the java code to count the number of similar words in given string and replace that word with new one
help me
help me  MY GLASSFISH SERVER NOT START PROPERLY help me warning shows DPL5404:Specification-Version for the optional package [ GNUJAXP ] in the jarfile [ C:\Program Files\Java\jdk1.7.0_02\jre\lib\ext\gnujaxp.jar
help me
help me  hi sir pls tell me how to use ajax form validatin from very simple way with two ot three text field pls help me use ajax in php my email id is:- rohit11tripathi@gmail.com pls sir give me some vasic information i know
help me..
help me..   what are the component needed by grid computing, cloud computing and ubiquitous computing? discuss about the security of above computing. difference between that 3 computing
Help me
Help me  Hi, LWUIT is working in eclipse j2me for Symbian OS
help me...
help me...  Write a program that inputs four words and them displays all possible permutations of the words. So, for example, if the words mad, dog, bites and man are entered, then the following are output : man bites mad dog
help me..
help me..  Write a program that inputs four words and them displays all possible permutations of the words. So, for example, if the words mad, dog, bites and man are entered, then the following are output : man bites mad dog mad
help me
button, and nationality I'm using dropdown list. Please help me. your kindness...help me  Hi I'm loges. I'm doing my final year project now, I have some problem in my project and i need some help on it. NowI'm doing a site
Struts 2
Struts 2  I am getting the following error.pls help me out. The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has
help me
help me  how to print from a-z, A-Z with exact order using for loop? Thanks for all concern
Help Me
Help Me  What is the source code for Sample example for Mortgage Calculator in J2ME language for developing Symbian
help me...
help me...  there is the picture given - cat - dog - rabbit - mouse a. create a class name b. create its attributes (at least 3 attributes) : species, size, leg c. create its methods ( at least 3 methods) : walk, eat, sleep
Help me
Help me  plz i want code of program to add real numbers and magic numbers in java example this input :- 5+3i-2+3i output:- 3+6i
help me
help me  pls... xplain dis code:- function go() { window.location.replace("logout.jsp",'window','toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1'); self.close
help me
help me
help me
the order, Fourth button is Find length of text. and there are panels. Please help me...help me  Dear sir/medam i would like to know how to use the java string class method my programm have four button,(enter the text) that first
Help me
Help me  hello!!!!. i have a Excel file which includes 4 columns and somewhat 8500 rows.these rows i have printed in SQL thru Excel file and i have 1 MYSql database which includes all those 4 fields i have defined in excel file
Ple help me its very urgent
Ple help me its very urgent  Hi.. I have one string 1)'2,3,4' i want do like this '2','3','4' ple help me very urgent
please help me to write a code for this program
please help me to write a code for this program   1 1 1 1 2 2 1 1 3 4 3 1 1 4 7 7 4 1
Can anybody tell me how to use #parameters in struts 2 ?
Can anybody tell me how to use #parameters in struts 2 ?  I have a login page, And by using struts.xml and #parameters I want to display error.../Login.jsp Its urgent. Pl help me out
please help me to write a code for this program
please help me to write a code for this program   1 1 1 1 2 1 1 3 3 1 1 4 6 4 1

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.