1.

WAP is Java to accept a number and find all its factors.

Answer»

import java.io.*;

class factors

{

public static void main(int n).

{

int a;

for (a=1; a<=n;a++)

{

if (n%a==0)

System.out.printIn(a+”is a factor of” +n);

}

}

}



Discussion

No Comment Found

Related InterviewSolutions