Check if there exists a prime number which gives Y after being repeatedly subtracted from X | Java implementation of the approach ; Function that returns true if any prime number satisfies the given conditions ; No such prime exists ; Driver code
import java . util . * ; class GFG { static boolean isPossible ( int x , int y ) { if ( ( x - y ) == 1 ) return false ; return true ; } public static void main ( String [ ] args ) { int x = 100 , y = 98 ; if ( isPossible ( x , y ) ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }