program to find total no. In array which are greater then given number in java.

■》 Code link -> click πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡


■> Program->


import java.util.*;
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

Popular posts from this blog

Introduction of java Programming language.

Stack data structure.