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 the difference between exit() and _exit() function?
Explain how to reverse singly link list.
How do c compilers work?
Explain what is the difference between far and near ?
What is New modifiers?
How can I trap or ignore keyboard interrupts like control-c?
Why do we use static in c?
Can you apply link and association interchangeably?
Do variables need to be initialized?
Can we use visual studio for c?
write a programe to accept any two number and check the following condition using goto state ment.if a>b,print a & find whether it is even or odd and then print.and a
What is the difference between declaring a variable by constant keyword and #define ing that variable?
What is a lookup table in c?
List some applications of c programming language?
what are the facialities provided by you after the selection of the student.