text: Check if Decimal representation of an Octal number is divisible by 7 | Java program to check if Decimal representation of an Octal number is divisible by 7 or not ; Function to check Divisibility ; Sum of all individual digits ; Condition ; Driver Code ; Octal number
code: import java . util . * ; import java . lang . * ; import java . io . * ; class GFG { static int check ( int n ) { int sum = 0 ; while ( n != 0 ) { sum += n % 10 ; n = n / 10 ; } if ( sum % 7 == 0 ) return 1 ; else return 0 ; } public static void main ( String args [ ] ) { int n = 25 ; String s = ( check ( n ) == 1 ) ? " YES " : " NO " ; System . out . println ( s ) ; } }