Create array

Q. Write a program to create array.


Ans.


/*c program for creation of array or list of numbers*/
#include<stdio.h>
#include<conio.h>
#define SIZE 50
int main()
{
 int arr[SIZE];
 int i,num;
 printf("Enter total number of elements : ");
 scanf("%d", &num);
 for(i=0; i<num; i++)
 {
   printf("Enter %d element : ",i+1);
   scanf("%d", &arr[i]);
 }
 printf("\n-- Creation of array --\n\n");
 for(i=0; i<num; i++)
   printf("\t%d\n", arr[i]);
 getch();
 return 0;
}


/**************** Output ******************/
Screen shot for creation of array


Related programs:

  1. Display array in reverse order
  2. Insert new element in array
  3. Delete an exist element in array
  4. Length of the array
  5. Example of array C program

Comments