#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],sum=0;
int *j;
int i,n;
clrscr();
printf("How many elements you want to add:");
scanf("%d",&n);
printf("Enter element:");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
j=&a[0];
for(i=0;i<n;i++)
{
sum=sum+*j;
j++;
}
printf("sum=%d",sum);
}
This blog will cover all important aspects of 'C' 'C++', 'Data Structures in C' and other Technical stuffs. In this blog you will find good C Interview Questions Answers. I will be posting both multiple choice and subjective type C interview questions and answers. Tutorials will be posted from time to time that will focus on problem solving.
Saturday, April 14, 2012
C language program to add numbers using pointers
Labels:
c,
c language,
programming,
simple c programs
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment