Define a Function array() which takes input in array and a function sum() which calculate the sum of the same array. Call the function in main() in a loop of five times – Simple loop and array question , matrix question , 2d array question

Define a Function array() which takes input in array and a function sum() which calculate the sum of the same array. Call the function in main() in a loop of five times – Simple loop and array question , matrix question , 2d array question
#include<stdio.h>
int array(int arr[]);int n;
int sum(int arr[]);
int main(int argc, char const *argv[])
{
printf(“Enter the no of element\n”);
scanf(“%d”,&n);
int arr[n];
array(arr);
printf(“sum : %d”,sum(arr));
return 0;
}
int array(int arr[])
{
printf(“enter the element:\n”);
for(int i=0 ; i<n ; i++)
{
scanf(“%d”,&arr[i]);
}
return 0;
}
int sum(int arr[])
{
int s; s=0;
for(int i=0 ; i<n ; i++)
{
s+=arr[i];
}
return s;
}
Programmed by : Sadhana
Topics Covered :
- declare matrix in c
- java matrix program
- arrays in c
- 2d array in java
- creation of matrix in java
- matrix c
- arrays in cpp
- 2d array in c
- traverse matrix in java
- matrix cpp
- 2d array in cpp
- arrays in c language
- arrays
- matrix in c
- passing arrays as arguments in c
- create a matrix in javascript
- matrix in cpp
- 2d array
- traverse matrix using for loop
- 2d array in java using scanner
- programming tutorial
- programming tutorial c++
- core java tutorial
- nested loops
Thanks for reading this blog. Hope you get satisfied with the blog and definitely this blog must have valued your time and effort of reading.
Take a time to connect our other digital creations such as Instagram , Facebook and Youtube.
Social Media Links of Tech DCode :
YouTube : https://www.youtube.com/channel/UCjJnEdeugftBwQ3yMuD4B_A
Instagram : https://www.instagram.com/thetechdcode/
Facebook Page : https://www.facebook.com/thetechdcode
Twitter : https://twitter.com/thetechdcode
Telegram Channel : https://t.me/thetechdcode
Tech DCode Linktree : https://linktr.ee/thetechdcode
My Personal Handles : https://linktr.ee/virtualshivamin
Social Media Links of SHIVAM SINGH (OWNER) :
Instagram : https://www.instagram.com/virtualshivamin/
Facebook Page : https://www.facebook.com/virtualshivamin/
Twitter : https://twitter.com/virtualshivamin/
Personal Linktree : https://linktr.ee/virtualshivamin