program to find total no. In array which are greater then given number in java.
■》 Code link -> click ππππ
■> Program->
class Main
{
public static void main(String[] args)
{
int count=0;
int[] arr = {12,13,5,67,8};
Scanner sc =new Scanner(System.in);
System.out.print("enter the no.=");
int n=sc.nextInt();
int mx=n;
for(int i=0; i<arr.length; i++){
if(arr[i]>mx)
count++;
}
System.out.println("the total no. which are greater then given number is ="+count);
}
}
■》Output->
enter the no.= 8
the total no. which are greater then given number is = 3
Comments
Post a Comment