+ 1
how do I get the seek function to return 1if it's seeking multiple specific items in this case 2,3,5
public class program{ public static int Seek(int[]arr,int num) { for(int i:arr){ if(num==i) { return 1; } } return 0; } public static void main (String [] args){ int[] myarray={2,3,5,7,11}; System.out.println (Seek (myarray,(2),(3,(5))); } }
3 Réponses
+ 2
1. The tag specific is not a good tag, instead tag the programming language, return and function.
+ 1
What do you mean?
+ 1
the code should look for multiple specific items and not only one... for example. the code is looking for items 2,3,5.if they are there in the array it shut return 1 else 0.