#include<stdio.h>
#include<conio.h>
void main()
{
int *a;
int i,size,sum=0;
clrscr();
printf("Please enter the number of
elements you want to insert ");
scanf("%d",&size);
a=(int *)calloc(sizeof(int),size);
for(i=0;i<size;++i)
{
printf("Enter the data for element %d
:",i+1);
scanf("%d",&a[i]);
}
printf("\nYour entered numbers are
");
for(i=0;i<size;++i)
{
printf("%d ",*(a+i));
}
for(i=0;i<size;++i)
{
sum=sum+a[i];
}
printf("\nThe summation of the entered
elements are %d",sum);
getch();
}
No comments:
Post a Comment