1d Array Program in C
Here you will get simple 1d array program in c language. In which, you will learn that how to declare one dimensional array, input values in array, and print the values of array.
Example of 1d Array Program in C
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | //One dimensional array program in c #include<stdio.h> int main() { int i,score[5]; // array declaration // Input elements in array printf("\nInput 5 numbers"); for(i=0;i<5;i++) { scanf("\n%d",&score[i]); } // Print values of elements printf("\nValues in the Array "); for(i=0;i<5;i++) { printf("\n%d",score[i]); } return 0; } |
Output
Input 5 numbers 3 6 4 8 2
Values in the Array
3
6
4
8
2
Check out our other C programming Examples