//Sample Program to Demonstrate the use of Array
#include < stdio.h >
#include < conio.h >
void main()
  {
  int a[10],i,n,sum;
  clrscr();
  sum=0;
  printf("Enter the number of elements: ");
  scanf("%d",&n);
  flushall();
  printf("\nEnter the elements\n\n");
  for(i=0;i < n;i++)
     {
     scanf("%d",&a[i]);
     flushall();
     }
  printf("\nEntered Array elements are\n\n");
  for(i=0;i < n;i++)
    {
    printf("%d\n",a[i]);
    sum=sum+a[i];
    }
    printf("\nSum of all the elements of array is: %d",sum);
    getch();
    }
<< GO BACK

Our aim is to provide information to the knowledge seekers.


comments powered by Disqus
Footer1