Sunday, November 2, 2014

Filled Under: , , , ,

Program to find factor of any number using command line argument.

Share




Code Box
------------------------------------

/* Program to find factor of any number using command line argument */

class factor
{
public static void main(String x[])
{
int num,i;
System.out.print("\n---------Factor Finder--------");
num=Integer.parseInt(x[0]);
System.out.print("\nYou have enter :"+num);

System.out.print("\nFactors of "+num+" are : ");
for(i=1;i<num;i++)
{
if(num%i==0)
{
System.out.print("  "+i);
}

}

}
}



0 comments:

Post a Comment