HackerRank C- Simple Array Sum




Complete the simpleArraySum function in the editor below. It must return the sum of the array elements as an integer.

simpleArraySum has the following parameter(s):

ar: an array of integers



  1. #include<stdio.h>
  2. main()
  3. {
  4. int n,i,sum=0;
  5. scanf("%d",&n);
  6. int a[n];
  7. for(i=0;i<n;i++)
  8. {
  9. scanf("%d",&a[i]);
  10. sum=sum+a[i];
  11. }
  12. printf("%d",sum);
  13. }
Please click on the like button if it worked

Solution not working or have any suggestions? Please send an email to [email protected]


donate a cup of tea :)


Join Our Facebook Group

Share this solution






codesadda.com

Codesadda.com is your home of programming solutions, tutorials, video tutorials and much more. Sign Up for our weekly newsletter to get update about new content.

Like us on Facebook | Connect with us on LinkedIn | Subscribe our Channel on Youtube