Results 1 to 2 of 2

Thread: hw help

  1. #1
    jihad is offline Member
    Join Date
    Oct 2011
    Posts
    24
    Rep Power
    0

    Default hw help

    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;
    }

    what should I do

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: hw help

    Quote Originally Posted by jihad View Post
    what should I do
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •