- #include
- #include
- 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();
- }
About Me
- Amit Singh Thakur
- Raipur, Chhattisgarh, India
- Hi , I am Amit Thakur. I have worked as a QA Engineer for two years and as a Java Developer for one year in NIHILENT TECHNOLOGIES PVT. LTD., Pune.Currently I am working as DEAN (Research & Development) in Bhilai Institute of Technology, Raipur.
Monday, September 2, 2013
Printing Array Elements in C Language
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment