Post Top Ad

Your Ad Spot

Pages

Wednesday, 27 May 2020

Calculate total sum of Array element


public static int SumOfarray(int []arr,int n)
{
        int sum=arr[0];
for(int i=1;i<n;i++)
{
sum=sum+arr[i];
}
     System.out.println("total"+sum);
      return sum;
}

No comments:

Post a Comment

Post Top Ad

Your Ad Spot

Pages