Computer Science, asked by saippathak81, 9 months ago

Create a function which accept an integer as parameter and return the largest digit create another function to input 10 integers and find the sum of the largest digit of each number in java

Answers

Answered by Rahul9048
4

public class Numbers {

public static void majn (String[] args) {

int a = 5;

int b = 38;

System.out.println(math.max(a , b));

}

}

**********************************************************************************************

import java.io.*;  

 

class GFG {  

     

  static int getSum(int n)  

   {      

       int sum = 0;  

         

       while (n != 0)  

       {  

           sum = sum + n % 10;  

           n = n/10;  

       }

   return sum;  

   }  

   public static void main(String[] args)  

   {  

       int n = 687;  

 

       System.out.println(getSum(n));  

   }  

}  

 

Similar questions