Sample C Program For Entering An Array Of Elements.


#include <stdio.h>
#include <conio.h>
#define S 5

main()
{

int a[S];
int i;
clrscr();

for( i = 0; i < S; i++ )
{
    printf("\n Enter a[%d] element: ",i);
    scanf("%d", &a[i]);
}
printf("Array elements are\n");

for( i = 0; i < S; i++ )
{
    printf("a[%d] = %d\n", i, a[i]);
}

getch();
}


OUTPUT:

Enter a[0] element: 4
Enter a[1] element: 3
Enter a[2] element: 6
Enter a[3] element: 7
Enter a[4] element: 9
Array elements are
a[0] = 4
a[1] = 3
a[2] = 6
a[3] = 7
a[4] = 9


ALSO CHECK THE FOLLOWING PROGRAMS:


- C Program On Two Dimensional (2-D) Array.

- C Program Counting Frequencies Of Elements Of Array.

- C Program To Insert An Element In An Array.

- C Program For Deleting An Element From An Array.

- C Program For Entering An Array Of Elements.

- C Program To Add Two Numbers Using Pointers.

- C Program To Concatenate Two Strings.

- C Program To Multiply Two Matrices.

- C Program To Add Two Matrices.

- C Program To Transpose A Matrix.

... Back To C Program Index.


Comments

Popular Posts