# Program to take input for 10 elements using an array. Further display all the elements.

Solution with out using functions
Solution using functions without passing arguments
Solution using functions and by passing arguments

## Program to take input for 10 elements using an array. Further display all the elements.

### Problem In Hand

To take input for 10 elements using an array further display all the elements

### Process and Solution Of Problem

* Using a for loop(any loop can be used) we take input for 10 elements
* again we use for loop to display all the elements

### Program/Source Code

```#include <stdio.h>

int main()
{
int a[10],i;
/* input */
for(i=0;i<10;i++)
{
printf("Enter %d element ",i);
scanf("%d",&a[i]);
}
/* display */
for(i=0;i<10;i++)
{
printf("%d\n",a[i]);
}
return 0;
}
```

### Program Explanation

* As we have to take input for 10 elements we declare an array of size 10.
* memory locations are created from 0 to 9 i.e. a[0] to a[9].
* Now using a for loop we take input for elements
* further we use for loop again to dislay the elements

### Output:

Enter 0 element 10
Enter 1 element 20
Enter 2 element 30
Enter 3 element 40
Enter 4 element 50
Enter 5 element 60
Enter 6 element 70
Enter 7 element 80
Enter 8 element 90
Enter 9 element 100
10
20
30
40
50
60
70
80
90
100

## Output:

Enter 0 element 25
Enter 1 element 63
Enter 2 element 45
Enter 3 element 2
Enter 4 element 95
Enter 5 element 6
Enter 6 element 3
Enter 7 element 25
Enter 8 element 6
Enter 9 element 25
25
63
45
2
95
6
3
25
6
25

## Output:

Enter 0 element 2
Enter 1 element 3
Enter 2 element 6
Enter 3 element 5
Enter 4 element 9
Enter 5 element 6
Enter 6 element 3
Enter 7 element 5
Enter 8 element 2
Enter 9 element 3
2
3
6
5
9
6
3
5
2
3

### Interview Questions

C Programming
C++ Programming
Class 11 (Python)
Class 12 (Python)
C Language
C++ Programming
Python

C Interview Questions
C++ Interview Questions
C Programs
C++ Programs

Important Pages