1) Write a C program that declares an integer array with 5 elements.
2) Inside a for() loop ask the user for a number and store it in the first element of the array (numerically the array is indexed from zero).
3) Your loop will iterate 5 times and each time you get a number you will fill up the next spot in the list. After 5 pieces of data have been entered your array will be full.
4) Write a second for() that looks at what is in the list. Find the largest number in the array. Print that number when you find it.
-------------------------------------------------------------------------------------------------------------------
Sample Output
Enter a number: 1234
Enter a number: -444
Enter a number: 900
Enter a number: 3
Enter a number: 2
The largest number in the list is 1234
Enter a number: -100
Enter a number: -3
Enter a number: -4
Enter a number: -2
Enter a number: -44
The largest number in the list is -2
-------------------------------------------------------------------------------------------------------------------
2) Inside a for() loop ask the user for a number and store it in the first element of the array (numerically the array is indexed from zero).
3) Your loop will iterate 5 times and each time you get a number you will fill up the next spot in the list. After 5 pieces of data have been entered your array will be full.
4) Write a second for() that looks at what is in the list. Find the largest number in the array. Print that number when you find it.
-------------------------------------------------------------------------------------------------------------------
Sample Output
Enter a number: 1234
Enter a number: -444
Enter a number: 900
Enter a number: 3
Enter a number: 2
The largest number in the list is 1234
Enter a number: -100
Enter a number: -3
Enter a number: -4
Enter a number: -2
Enter a number: -44
The largest number in the list is -2
-------------------------------------------------------------------------------------------------------------------
Comment