public static void main (String args[]) {
int a;
int[]b=new int [10];
for (a=0; a<b.length; a++){
String c=JOptionPane.showInputDialog ("Enter a number:");
int d=Integer.parseInt ©;
}
String searchId=JOptionPane.showInputDialog ("Enter number search:");
int f=Integer.parseInt (searchId);
int e;
for (e=0; e<b.length; e++){
if (b[e]==f)
break;
if (e!=f){
System.out.println ("Can't find number search "+f);
}
else{
System.out.println("Found number search "+f);
}
}
and i want to know how to make the output just:
"Cant find number search .. " for integers not on the array and
"Found number search.." for found integers in array... and NOT:
Can't find number search 7
Can't find number search 7
Can't find number search 7
Can't find number search 7
Can't find number search 7
Can't find number search 7
Can't find number search 7
Found number search 7
Can't find number search 7
Can't find number search 7....
just one output...
help please...
thanks again....


Sign In
Create Account


Back to top









