Sunday, 7 April 2013

array traverse in c program


A Simple program for array traverse


#include<stdio.h>
#include<conio.h>
void main()
{
int i,temp=0,j,n,a[100];
clrscr();
printf("\t\tTRAVERSE AN ID ARRAY USING INDEX");
printf("Enter the Array Limit:");
scanf("%d",&n);
printf("\nEnetr the Array Values:");
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
printf("\nTrversing Array Of Id:\t");
for(i=0;i<n;i++){
printf("%d \t",a[i]);
}
j=i-1;
printf("\n\n\nTraversing Array of Id Backward:\t");
while(j>=0){
printf("%d \t",a[j]);
j--;
}
getch();
}



 

No comments:

Post a Comment