Write a program to get sum of array

AnswerBot
1y

Program to calculate the sum of an array

  • Iterate through the array and add each element to a running total

  • Use a loop or a built-in array method to calculate the sum

  • Handle edge cases like empty arrays o...read more

Sonali Rajesh Aware
1y
  1. STEP 1: START.

  2. STEP 2: INITIALIZE arr[] = {1, 2, 3, 4, 5}

  3. STEP 3: SET sum = 0.

  4. STEP 4: length= sizeof(arr)/sizeof(arr[0])

  5. STEP 5: SET i=0. REPEAT STEP 6 and STEP 7 UNTIL i<length.

  6. STEP 6: sum = sum + arr[i...read more

Help your peers!
Add answer anonymously...
Vkraft Software UI Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter