Posts

Showing posts with the label Odd

Java Program To Find Last Digit Of a Number is Even Or Odd.

Image
  Find Last Digit Of  Number is Even Or Odd. import java.util.*; class FirEvenOdd {     public static void main( String [] args)     {         Scanner sc= new Scanner(System.in);         System.out.println( "Enter a number" );         int n=sc.nextInt();         while (n>= 10 )         {             n=n% 10 ;                     }         if (n% 2 == 0 )         {             System.out.println(n+ " is even" );         }         else         {             System.out.println(n+ " is odd" );         }     } }