C Program for 1-D array Implementation

C Program for 1-D array Implementation

//Our Program will take input as an integer value for 1-D array and print it on the screen.

#include <stdio.h>     // header files
#include <stdlib.h>

int main()  // main function starts from here
  int arr[5],n; // variable declaration
  printf("\n Enter the number of elements you want to enter");
  scanf("%d",&n); // taking input as the length of array

  printf("\n Enter %d elements of 1D aray",n);
   for(int i = 0;i<n;i++)   // for loop
     scanf("%d", &arr[i]);
 for(int i = 0;i<n;i++) // loop for printing the entered array
   printf("\n %d", arr[i]);

return 0;
}   // end of main function

RESULT:  Output

C Program for 1-D array Implementation

1-D array implementation

The above code can’t be directly copy-pasted. You must have to type with your own hand. This is made for your better future. 

Are you made for copy paste?

Absolutely “NO”

Then, try hard to understand this code and type with your own.

About the Author: Make toss

Leave a Reply

Your email address will not be published. Required fields are marked *