Loops are used for array input/outputs. To access the individual elements of array, we use subscripts as a[subscript], where subscript could be a constant integer like 0 , 1, 5 or a integer variable like i, j or a integer expression like (i+j+2). One important thing to note is that the value of subscript should be integer. e.g: #include<stdio.h> #include<conio.h> void main() { int a[10], i; clrscr(); printf("Enter 10 numbers:\n"); for(i=0;i<10;i++) scanf("%d",&a[i]); /* array input */ printf("\n You have entered these 10 numbers:\n"); for(i=0;i<10;i++) printf("\t%d",a[i]); /* array output*/ getch(); } ...
Learn something about IT