Program to find remainder when large number is divided by 11 | JAVA implementation to find remainder when a large number is divided by 11 ; Function to return remainder ; len is variable to store the length of number string . ; loop that find remainder ; Driver code
import java . io . * ; class GFG { static int remainder ( String str ) { int len = str . length ( ) ; int num , rem = 0 ; for ( int i = 0 ; i < len ; i ++ ) { num = rem * 10 + ( str . charAt ( i ) - '0' ) ; rem = num % 11 ; } return rem ; } public static void main ( String args [ ] ) { String str = "3435346456547566345436457867978" ; System . out . println ( remainder ( str ) ) ; } }