Java program to find all the dividers of any number.


import java.util.Scanner;
public class FindDividers
{
  public static void main(String[] args)
{
int num,i;
Scanner s=new Scanner(System.in);
System.out.print("Enter any Integer number:");
num=s.nextInt();
s.close();
System.out.print("***All deviders of "+num+" are***");
for(i=1;i<=num;i++)
{
     if(num%i==0)
    {
       System.out.print("\n"+i);
    }
}
}
}


*** Input && Output ***



Post a Comment

0 Comments