Java Find Season Program

Find Season


William planned to choose a four digit lucky number for his car. His lucky numbers are 3,5 and 7. Help him find the number, whose sum is divisible by  3 or 5 or 7.
Provide a valid car number, Fails to provide a valid input then display that number is not a valid car number. 

Note : The input other than 4 digit positive number[includes negative and 0] is considered as invalid.

Refer the samples, to read and display the data.

Sample Input 1:
Enter the car no:1234

Sample Output 1:
Lucky Number

Sample Input 2:

Enter the car no:1214

Sample Output 2:

Sorry its not my lucky number

Sample Input 3:

Enter the car no:14

Sample Output 3:

14 is not a valid car number

Code :-

import java.util.Scanner;
public class Season 
    public static void main (String[] args) {
        Scanner sc = new Scanner(;
        System.out.println("Enter the month:");
            int mon=sc.nextInt();
                System.out.println("Invalid month");
            else if(mon>=3&&mon<=5)
            else if(mon>=6&&mon<=8)
            else if(mon>=9&&mon<=11)
            else if(mon==12||mon==1||mon==2)


  1. Lucky Number
  2. Pencil Count
  3. Repetition of a Number
  4. Bonus Points – Bike Race
  5. Celcius to Farenheit Conversion
  6. Check for Leap Year

Leave a Comment

Your email address will not be published. Required fields are marked *