Thursday, January 9, 2014

Program to show the number is divided by 5 and 7 or not.

import java.util.*;
public class No5n7
{
    public static void main(String args[])
    {
        Scanner s=new Scanner(System.in);
        System.out.print("Enter the number : ");
        int n=s.nextInt();
        if(n%5==0 && n%7==0)
        {
            System.out.println("This is divisible");
        }
        else
        {
            System.out.println("This is non-divisible");
        }
    }
}

Output:


No comments:

Post a Comment