Check if a large number is divisible by 5 or not | Java program to find if a number is divisible by 5 or not ; Function to find that number divisible by 5 or not . The function assumes that string length is at least one . ; main function
class IsDivisible { static boolean isDivisibleBy5 ( String str ) { int n = str . length ( ) ; return ( ( ( str . charAt ( n - 1 ) - '0' ) == 0 ) || ( ( str . charAt ( n - 1 ) - '0' ) == 5 ) ) ; } public static void main ( String [ ] args ) { String str = "76955" ; if ( isDivisibleBy5 ( str ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }