public class CDM_P6 {
public static void main(String[] args) {
float []mark = {56.9f,67.8f,78.9f,90.4f,34.9f};
float num = 56.9f;
boolean array = false;
for(float element:mark){
if(num==element){
array = true;
break;
}
}
if(array){
System.out.println("The value is present in the array:");
}
else{
System.out.println("The value is not present in the array:");
}
}
}
//output
The value is present in the array: Process finished with exit code 0

0 Comments