Wednesday, 6 August 2014

#include<stdio.h>
#include<conio.h>
main()
     {
          int n,i,k,LB,UB,A[10];
          printf("enter the total number of elements of array:");
          scanf("%d",&n);
          printf("enter the element in the array:\n");
          for(i=1;i<n;i++)
          {
                          printf("Element number[%d]is",i);
                          scanf("%d",&A[i]);
                          }
                          LB=1;
                          UB=n;
                          k=LB;
                          printf("\n\n");
                          printf("Traversing of array is:\n");
                          while(k<=UB)
                          {
                                      printf("Element number[%d] is %d\n",k,A[k]);
                                      k=k+1;
                                      }
                                      getch();
                                      }
Enter the total no of elements of array:5
Enter the element in the array:
Element number[1] is 5
Element number[2] is 6
Element number[3] is 7
Element number[4] is 2
Traversing of array is:
Element number[1] is 5
Element number[2] is 6
Element number[3] is 7
Element number[4] is 2

No comments:

Post a Comment

Note: only a member of this blog may post a comment.