write a 'c' program to sum the number of integer values
Answer Posted / vignesh1988i
here the program uses dynamic memory allocation concept instead of arraya......
#include<stdio.h>
#include<conio.h>
void main()
{
int *pointer,n,sum=0;
clrscr();
printf("enter no. of elements :");
scanf("%d",&n);
pointer=(int*)malloc(n*sizeof(int));
for(int i=0;i<n;i++)
{
scanf("%d",(pointer+i));
sum=sum+(*(pointer+i));
}
printf("the sum is :%d",sum);
getch();
}
thank u
| Is This Answer Correct ? | 11 Yes | 17 No |
Post New Answer View All Answers
What is a program flowchart and how does it help in writing a program?
What are structure members?
What is actual argument?
What is static memory allocation?
Differentiate between null and void pointers.
What is the mean of function?
What is #include stdio h and #include conio h?
How can I call fortran?
Describe explain how arrays can be passed to a user defined function
What are the standard predefined macros?
Is fortran still used in 2018?
How will you find a duplicate number in a array without negating the nos ?
how to introdu5ce my self in serco
What is FIFO?
What is c variable?