#include<stdio.h>
#include<conio.h>
main()
{
int n,i,*p,sum=0;
printf("enter the size of the array");
scanf("%d",&n);
int a[n];
printf("enter the elements of array");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
p=&a[0];
for(i=0;i<n;i++)
{
sum=sum+*p;
p++;
}
printf("sum of array element=%d",sum);
getch();
}
#include<conio.h>
main()
{
int n,i,*p,sum=0;
printf("enter the size of the array");
scanf("%d",&n);
int a[n];
printf("enter the elements of array");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
p=&a[0];
for(i=0;i<n;i++)
{
sum=sum+*p;
p++;
}
printf("sum of array element=%d",sum);
getch();
}
No comments:
Post a Comment