Check if the number formed by the last digits of N numbers is divisible by 10 or not | Java implementation of the approach ; Function that returns true if the number formed by the last digits of all the elements is divisible by 10 ; Last digit of the last element ; Number formed will be divisible by 10 ; Driver code
import java . util . * ; class GFG { static boolean isDivisible ( int arr [ ] , int n ) { int lastDigit = arr [ n - 1 ] % 10 ; if ( lastDigit == 0 ) return true ; return false ; } static public void main ( String [ ] arg ) { int arr [ ] = { 12 , 65 , 46 , 37 , 99 } ; int n = arr . length ; if ( isDivisible ( arr , n ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }