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...

Ca some one please help me with aC code to allow user enter
numbers from 1 to 20 without repeating and prnt the sum of
those numbers
thnx

Answer Posted / asadhsheriff

int main()
{
int a[20],i,j,count=0;
memset(a,0,20);
for(;count<=20;)
{
scanf("%d",&j);
if(a[j]==0)
{
count++;
a[j]=j;
}
}
i=20(10)/2;
printf("The sum is %d",i);
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

#include main() { enum _tag{ left=10, right, front=100, back}; printf("left is %d, right is %d, front is %d, back is %d",left,right,front,back); }

1103


how to solve "unable to open stdio.h and conio.h header files in windows 7 by using Dos-box software

3298


What is unsigned int in c?

970


Explain the use of 'auto' keyword in c programming?

1102


What is I ++ in c programming?

1099


Program to find the sum of digits of a given number until the sum becomes a single digit. (e.g. 12345=>1+2+3+4+5=15=>1+5=6)

1135


Do you know null pointer?

1011


Is there anything like an ifdef for typedefs?

1137


How does normalization of huge pointer works?

1152


What is the difference between single charater constant and string constant?

1073


Tell me is null always defined as 0(zero)?

1075


What language is lisp written in?

1242


Apart from dennis ritchie who the other person who contributed in design of c language.

1380


What is the use of extern in c?

1079


What are reserved words with a programming language?

1121