WAP IN JAVA to find sum of 'n' numbers using CALL BY REFERENCE


class innovation
{
public int a;
public int sum=0;
void add(innovation two)
{
two.a=a;
for(;a<=10;a++)
{
two.sum=a+sum;
System.out.println(sum);
}
}
public static void main(String args[])
{
innovation one=new innovation();
one.a=1;
one.add(one);
}
}
USE ANY NUMBER IN PLACE OF 10
  • WAP IN JAVA to find sum of 'n' numbers using CALL BY REFERENCE
  • Shubam Bharti
  • Saturday 12 April 2014
  • No comments:
 

0 comments:

Post a Comment