C One Dimensional Array Program

« Previous Program Next Program »

One Dimensional Array Program in C

To print one dimensional array in C programming, you have to use only one for loop

C Programming Code on One Dimensional (1D) Array

Following C program ask to the user to enter the array size, then ask to enter the element of the array to store the elements in the array, then finally display the array element on the screen:

/* C Program - One Dimensional Array */
void main()
	int arr[50], n;
	printf("How many element you want to store in the array ? ");
	printf("Enter %d element to store in the array : ",n);
	for(int i=0; i<n; i++)
	printf("The Elements in the Array is : \n");
	for(i=0; i<n; i++)
		printf("%d  ",arr[i]);

When the above c program is compile and executed, it will produce the following result:

c program one dimensional array

Same Program in Other Programming Language

You may also like same program in other programming languages:

« Previous Program Next Program »


Quick Links
Signup - Login - Give Online Test