#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
int main()
{
int n, *p, i, ans = 0;
printf("Enter Array Element Number : ");
scanf("%d", &n);
p = (int*) calloc(n, sizeof(int));
if(p == NULL)
{
printf("Error! Memory Not Allocated.");
exit(0);
}
printf("\nEnter Element Of Array : ");
for(i=0;i<n;i++)
{
scanf("%d", p);
ans = ans + *p;
p++;
}
printf("\nSummation OF Array : %d\n", ans);
free(p);
getch();
}
#include<stdlib.h>
#include<conio.h>
int main()
{
int n, *p, i, ans = 0;
printf("Enter Array Element Number : ");
scanf("%d", &n);
p = (int*) calloc(n, sizeof(int));
if(p == NULL)
{
printf("Error! Memory Not Allocated.");
exit(0);
}
printf("\nEnter Element Of Array : ");
for(i=0;i<n;i++)
{
scanf("%d", p);
ans = ans + *p;
p++;
}
printf("\nSummation OF Array : %d\n", ans);
free(p);
getch();
}
Comments
Post a Comment