C Program to Read Array Elements

#include<stdio.h>
#include<conio.h>
void main()
{
 int i,a[50],sum,n;
 printf("n Enter no of elements :");
 scanf("%d",&n);

 /* Reading values into Array */

 printf("n Enter the values :");
 for(i=0;i < n;i++)
 scanf("%d",&a[i]);

 /* computation of total */

 sum=0;
 for(i=0;i < n;i++)
 sum=sum+a[i];

 /* printing of all elements of array */

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

 /* printing of total */

 printf("n sum=%d",sum);

getch();
}

Share this

Related Posts

:)
:(
hihi
:-)
:D
=D
:-d
;(
;-(
@-)
:P
:o
:>)
(o)
:p
:-?
(p)
:-s
(m)
8-)
:-t
:-b
b-(
:-#
=p~
$-)
(y)
(f)
x-)
(k)
(h)
cheer