C Program to check Leap Year

#include <stdio.h>
int main()
{
    int y;

    printf("Enter year: ");
    scanf("%d",&y);

    if(y % 4 == 0)
    {
        if( y % 100 == 0)
        {
            if ( y % 400 == 0)
                printf("%d is a Leap Year", y);
            else
                printf("%d is not a Leap Year", y);
        }
        else
            printf("%d is a Leap Year", y );
    }
    else
        printf("%d is not a Leap Year", y);

    return 0;
}
import java.util.*;
public class prac2{
    public static void main(String[] args){
  /* Ask user to input the from/to range
    like 1 to 100, 10 to 1000 etc.
  */
        System.out.println("Enter two range(input integer numbers only):");
        Scanner sc=new Scanner(System.in);
        int num1=sc.nextInt();
        int num2=sc.nextInt();
        //Store the range in variables using scanf.
        //Display prime numbers for input range.
        System.out.println("Prime numbers from :"+ num1+ num2);
        for(int i=num1+1; i<num2; ++i)
        {
            int flag_var=0;
            for(int j=2; j<=i/2; ++j)
            {
                if(i%j==0)
                {
                    flag_var=1;
                    break;
                }
            }
            if(flag_var==0)
                System.out.println(i);
        }
    }
}

OUTPUT

Enter year: 1991
1991 is not a Leap Year