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

    Default someone can help me to find where is the mistake

    when I enter value it gave always is not perfect number


    static void perfectn()
    {int a;
    Scanner cso=new Scanner(System.in);
    a=cso.nextInt();
    int z,x,y;x=0;
    for(z=1;z<=a;z++)
    {
    if(a%z==0){x=x+z;}
    }
    if(a==x){System.out.println(a+" is perfect number");}
    else System.out.println(a+" is not perfect number");

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

    Default Re: someone can help me to find where is the mistake

    Print out the value of x at the end of your method and see if it makes sense by comparing it with what you calculate on paper it should be. With this number you should be able to figure out your bug. Another hint: look at your for loop control statement (the first line that begins for (... ) because that's where your bug is.

    um, nice forum name by the way. I think.
    Last edited by Fubarable; 10-22-2011 at 01:56 PM.

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

    Default Re: someone can help me to find where is the mistake

    thanks alot there is an = and it doesnt work correctly programming is laughable
    are you muslim

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

    Default Re: someone can help me to find where is the mistake

    Quote Originally Posted by jihad View Post
    thanks alot there is an = and it doesnt work correctly programming is laughable
    are you muslim
    Good, you saw it. And no, I am Jewish.

    Bettawfeeq

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

    Default Re: someone can help me to find where is the mistake

    hmm
    I have another question
    I should write a program that should print leap year in 21.century (2001 to 2102)
    these are codes

    public class P32 {
    public static void main(String[] args)
    { int a,b,c;

    for(a=2001;a<2103;++a)
    { if((a%4==0)&&(a%100!=0)||(a%400==0))
    System.out.println(a+" ");
    }


    }


    }

    what is wrong

  6. #6
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,004
    Blog Entries
    7
    Rep Power
    20

    Default Re: someone can help me to find where is the mistake

    Quote Originally Posted by jihad View Post
    what is wrong
    You tell us the symptoms of what is wrong; we are not going to debug badly indented, badly formatted code for you.

    Jos

    ps I find your screen name rather stupid.
    cenosillicaphobia: the fear for an empty beer glass

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

    Default Re: someone can help me to find where is the mistake

    actually it is my real name
    it is not stupid it has very deep meaning
    I cant explain but basicly it means to fight for Allah who create you
    but every person has different mind it can be stupid for you

    by the way you are so tough if you dont want to help you dont write
    why you are acting like that

  8. #8
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,004
    Blog Entries
    7
    Rep Power
    20

    Default Re: someone can help me to find where is the mistake

    Quote Originally Posted by jihad View Post
    actually it is my real name
    it is not stupid it has very deep meaning
    I cant explain but basicly it means to fight for Allah who create you
    but every person has different mind it can be stupid for you

    by the way you are so tough if you dont want to help you dont write
    why you are acting like that
    Everyone is free to write here; you can't forbid anyone to do so; I can't forbid you to write here and I don't even attempt to do so. The 'deep' meaning of you name is in the eye of the beholder; it isn't 'deep' for me (I don't believe in any god at all b.t.w.) and I find it insulting; it isn't your fault if it is your real name.

    Jos
    cenosillicaphobia: the fear for an empty beer glass

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

    Default Re: someone can help me to find where is the mistake

    if you dont believe god I cant explain the perfect side of the name because I dont have enough information it is very religious word .there are maybe millions of book which try to explain meanning of jihad but if you search islam you will see what is jihad and why people are doing jihad
    if you add me on facebook or msn I will try to explain more thing about doing jihad

  10. #10
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,004
    Blog Entries
    7
    Rep Power
    20

    Default Re: someone can help me to find where is the mistake

    Quote Originally Posted by jihad View Post
    if you dont believe god I cant explain the perfect side of the name because I dont have enough information it is very religious word .there are maybe millions of book which try to explain meanning of jihad but if you search islam you will see what is jihad and why people are doing jihad
    if you add me on facebook or msn I will try to explain more thing about doing jihad
    Many, many bad things have been done in the name of (a) jihad (especially against non-muslim societies) so the name has (at least to me) a very bad connotation.

    Jos

    ps. discussion closed
    cenosillicaphobia: the fear for an empty beer glass

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

    Default Re: someone can help me to find where is the mistake

    these things are imposed by western media but you dont know what these muslim people try to do they just want to live their land in peace but these topic very dangerous to discuss in local channel .
    I Just want to say Muslims are not terrorist if you have a chance to met a good muslim you will change your idea I am a muslim and I am not a terorist I hoop you will met with a good muslim also there are millions of good muslims

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

    Default Re: someone can help me to find where is the mistake

    I think that we know this. No one has a monopoly on terrorism or doing harm or good in the name of their religion.

    But we're getting away from discussions of Java by just a bit.

Similar Threads

  1. Hello, I got a mistake
    By F1ke in forum New To Java
    Replies: 7
    Last Post: 09-25-2011, 08:11 PM
  2. Help me ! identifying the mistake
    By o0oNorao0o in forum New To Java
    Replies: 6
    Last Post: 11-06-2010, 10:03 PM
  3. i can't see the mistake
    By PVL268 in forum New To Java
    Replies: 3
    Last Post: 04-29-2009, 05:26 AM
  4. i can't see the mistake
    By PVL268 in forum New To Java
    Replies: 2
    Last Post: 04-28-2009, 06:30 AM
  5. PLEASE!!!help me to find mistake
    By sasha20 in forum New To Java
    Replies: 1
    Last Post: 01-11-2008, 10:50 AM

Posting Permissions

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