PROGRAM TO TRAVERSING OF ARRAY

//TRAVERSING OF ARRAY//
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,k,LB,UB,A[10];
clrscr();
printf(“Enter the total number of elements of array:”);
scanf(“%d”,&n);
printf(“Enter the elements in the array:\n”);
for(i=1;i<=n;i++)
{
printf(“Element number [%d] is “,i);
scanf(“%d”,&A[i]);
}
//TRAVERSING BEGINS//
LB=1;
UB=n;
k=LB;
printf(“\n\n”);
printf(“Traversing of array is:\n”);
while(k<=UB)
{
printf(“Element number [%d] is %d\n”,k,A[k]);
k=k+1;
}   //TRAVERSING ENDS//
getch();
}

Leave a Reply

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