Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
ArrayOperation
import java.util.*; class Rextester{ public static void main(String args[]){ int i; int flag=0; int[] a = new int[1000]; System.out.print("How numbers in the array = "); Scanner obj =new Scanner(System.in); int n= obj.nextInt(); for(i=0;i<n;i++) { System.out.println("Int value at index "+i+ " = " ); a[i]= obj.nextInt(); } System.out.println("Check for a number in the array Y/N? "); char ch = obj.next().charAt(0); if(ch=='Y'|| ch=='y') { System.out.println("Enter the search element "); int se = obj.nextInt(); for(i=0;i<n;i++) { if(se==a[i]) {flag=1; System.out.println("The element is present at the position number "+ ++i+" in the array set"); } } if(flag ==0) System.out.println("The Element is not present in the array"); } else if(ch=='N'|| ch=='n') System.out.println("Well, Okay. Thanks for testing out this program"); else System.out.println("Wrong Entry,anyways thanks for testing out the code."); }}
run
|
edit
|
history
|
help
0
1(B)
Ways to form Max Heap
To check whether a given number is smith number or not
Assignment for Web Software Developer position
1
Document management system - build unordered list (table of contents) recursively
Switch
Coding Numbers - Duplicate - HashSet
JAVA # Klavyeden girilen ayın Mevsimini bulma
2D List Iterator