Array Minimum in C
Level 3117 keystrokes
Finds the minimum value in an integer array using a loop.
C code
// The values to search1int a[] = {8, 3, 9, 1, 5};// The first element is the minimum so far2int min = a[0];// Without braces, the loop body is only the next statement (the if)3for (int i = 1; i < 5; i++) // Keep the smaller value: 8 → 3 → 14 if (a[i] < min) min = a[i];// Runs once after the loop and prints 15printf("%d", min);Output
1
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this C code and how often they appear.
;× 6,× 5[× 4]× 4=× 4(× 3)× 3"× 2+× 2<× 2