Java Program to find the factors of Entered Number

import java.util.*;
class scan
{
 public static void main(String arg[])
  {
   int x,i;
   Scanner kb=new Scanner(System.in);
    System.out.println("Enter Number:- ");
	x=kb.nextInt();
	for(i=1;i<=x;i++)
	 {
	  if(x%i==0)
	   {
	    System.out.println(i);
	   }
	 }
	}
}

OUTPUT:-

factors

Leave a Reply

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