Friday 25 June 2010

1D Array: Example program on array

// Simple program on 1-D array

#include<stdio.h>
#include<conio.h>
void main()
{
 int a[5],i;
 clrscr();
 printf("enter the values into array\n");
 for(i=0;i<5;i++)
  scanf("%d",&a[i]);
 printf("array is\n");
 for(i=0;i<5;i++)
 printf("%d\n",a[i]);
 getch();
}

/*
Enter the values into array
I/p:

2
3
4
5
6

Result
Array is
2
3
4
5
6

*/

You may like the following posts:
Arrays

No comments:

Post a Comment