Question
write a c program
14. Write a function that gets two numbers (as parameters) and returns their sum. Write a program that uses the above functio
0 0
Add a comment Improve this question Transcribed image text
Answer #1

/*
 *  C Program for Array Sum using functions
 */

#include <stdio.h>
#define MAX 10

int sumTwo(int x, int y)
{
  return x + y;
}

int main()
{
  int arrayNum[MAX] = {10,11,12,13,14,15,16,17,18,19};
  int i, arraySum = 0;

  for (i = 0; i < MAX; i++)
  {
    arraySum = sumTwo(arraySum, arrayNum[i]);
  }
  
  printf("Array Sum: %d\n", arraySum);

  return 0;
}

Note: For queries, drop me a comment.

Add a comment
Know the answer?
Add Answer to:
write a c program 14. Write a function that gets two numbers (as parameters) and returns...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT