Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Can the “if” function be used in comparing strings?

1105


What does double pointer mean in c?

1252


hi any body pls give me company name interview conduct "c" language only

2322


Is c# a good language?

1055


What are the types of unary operators?

1249


What is the use of putchar function?

1107


Explain union.

1236


Which is not valid in C a) class aClass{public:int x;}; b) /* A comment */ c) char x=12;

1127


What does nil mean in c?

1345


Explain what is the use of a semicolon (;) at the end of every program statement?

1260


Is there any algorithm to search a string in link list in the minimum time?(please do not suggest the usual method of traversing the link list)

2334


Can a variable be both constant and volatile?

1176


Write a program to swap two numbers without using third variable in c?

1179


What is queue in c?

1151


Explain do array subscripts always start with zero?

1282