Sum of Positive Integers below Input

View previous topic View next topic Go down

Sum of Positive Integers below Input

Post by shirish.vogga on 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);
    }
}
avatar
shirish.vogga
New LSF Member
New LSF Member

Posts : 3

Back to top Go down

View previous topic View next topic Back to top


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