LFPS - Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Sum of Positive Integers below Input

Go down

Sum of Positive Integers below Input Empty Sum of Positive Integers below Input

Post by shirish.vogga Sun Aug 15, 2010 8:38 pm

Code:

class Add
{
    private int a;
    Add(int z)
    {
        int a=0;
        for(int i=1;i<=z;i++)
        a=a+i;
        System.out.println(a);
    }
    public static void main(String[ ] args)
    {
          int x=Integer.parseInt(args[0]);
          Add obj=new Add(x);
    }
}
shirish.vogga
shirish.vogga
New LSF Member
New LSF Member

Posts : 3

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum