Thursday, 18 July 2013

Program in C to Traverse an Array

#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,a[10];
clrscr();
printf(“Enter the length of array\n”);
scanf(“%d”,&n);
printf(“Enter the element of array\n”);
for(i=0;i<=n;i++)
{
scanf(“%d”,&a[i]);
}
printf(“Traversing of the array\n”);
for(i=0;i<=n-1;i++)
printf(“\n%d”,a[i]);
getch();

3 comments: