Skip to content

Commit ae93438

Browse files
committed
passing arrays
1 parent 5e5d6cf commit ae93438

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

prog.8.9.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Function to find the minimum value in an array
2+
3+
#include <stdio.h>
4+
5+
int minimum (int values[10])
6+
{
7+
int minValue, i;
8+
9+
minValue = values[0];
10+
11+
for ( i = 1; i < 10; ++i )
12+
if ( values[i] < minValue )
13+
minValue = values[i];
14+
15+
return minValue;
16+
}
17+
18+
int main (void)
19+
{
20+
int scores[10], i, minScore;
21+
int minimum (int values[10]);
22+
23+
printf ("Enter 10 scores\n");
24+
25+
for ( i = 0; i < 10; ++i )
26+
scanf ("%i", &scores[i]);
27+
28+
minScore = minimum (scores);
29+
printf ("\nMinimum score is %i\n", minScore);
30+
31+
return 0;
32+
}

0 commit comments

Comments
 (0)