Thursday, 25 August 2022

Max value in array


 public class HelloWorld{


     public static void main(String []args){

        System.out.println("Hello, World!");

        int arry[] = new int[]{1,2,33,33,6,6};

        int max = arry[0];

          for(int i=1; i<arry.length;i++){

                 if(arry[i]> max){

                     max = arry[i];

                 }

            

         }

          System.out.println("Hello, World!"+max);

     }

}

Wednesday, 24 August 2022

 /* palindrome Number */

public class HelloWorld{


     public static void main(String []args){

        System.out.println("Hello, World!");

        int rem, sum =0, temp;

        int num=151;

        temp=num;

        while(num>0){

            rem = num%10;

            sum =(sum*10)+rem;

            num =num/10;

            

        }

        if (temp == sum){

              System.out.println("palindrome");

        }

        else{

              System.out.println("Hello, not");

        }

     }

}