Write a program that reads an integer and displays all its smallest factors in increasing
order.
int a,b,c,d;c=1;
Scanner cso=new Scanner(System.in);
a=cso.nextInt();
for(b=1;b<a;b++)
{
if(a%b==0){
System.out.print(b+" ,");
c=c*b;
}
if(c==a)break;
}
I would "...write a program that reads an integer and displays all its smallest factors in increasing
order." If my program didn't work, I'd consider asking for help, telling us exactly what's wrong with my current program.
Bookmarks