 # Input 10 numbers in 1d array and find largest and the smallest number position in C

###### One Dimensional Array - Question 3

In this question, we will see how to input 10 numbers in a one dimensional integer array and find the position of the largest and the smallest number in C programming. To know more about one dimensional array click on the one dimensional array lesson.

Q3) Write a program in C to input 10 numbers in a one dimensional integer array and find the position of the largest and the smallest number.

#### Program

``````#include <stdio.h>
#include <conio.h>

int main()
{
int a, i,ln,lnp,sn,snp;

printf("Enter 10 numbers\n");
for(i=0; i<10; i++)
{
scanf("%d",&a[i]);
}

for(i=0; i<10; i++)
{
if(i==0)
{
ln=a[i];
sn=a[i];
lnp=i;
snp=i;
}
else if(a[i]>ln)
{
ln=a[i];
lnp=i;
}
else if(a[i]<sn)
{
sn=a[i];
snp=i;
}
}

printf("Largest Number Position = %d\n",lnp+1);
printf("Smallest Number Position = %d\n",snp+1);
return 0;
}``````

#### Output

```Enter 10 numbers
63
12
57
61
98
11
3
4
75
82
Largest Number Position = 5
Smallest Number Position = 7``` 