Hi guys, can I ask how can I create a C Program that will ask the user to enter 10 integer numbers and display the minimum & maximum values and the number of INDECES in between them.
Example.
I am asked to input 10 integer numbers, so for example i'll input 1, 2, 3, 4, 5, 6, 7, 8, 9, 10.
Now my output should be:
The indeces between 1 and 10 is 9.
So far here's what I got.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
#include<stdio.h>
#include<conio.h>
#define SIZE 10
main()
{
int number[SIZE], i, sum = 0;
float ave;
printf("Enter %d numbers:\n", SIZE);
for (i = 0; i < SIZE; i++)
// accept the inputs
scanf("%d", &number[i]);
// display the values
for (i = 0; i < SIZE; i++)
{
// display the values
printf("number[%d] = %d\n", i, number[i]);
}
getch();
}
|
Now my problem:
I don't know how to make it display the indeces.
Anyone? Thanks guys!
P.S I'm new to C++ so i'm also just looking for basic codes (similar to what I have right now)