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

What is %d used for?

1025


What is static function in c?

1111


Why do we use null pointer?

1049


Can you think of a logic behind the game minesweeper.

2455


Device an algorithm for weiler-atherton polygon clipping, where the clipping window can be any specified polygon

5941


How do you use a pointer to a function?

1070


Explain what are global variables and explain how do you declare them?

1148


Can I initialize unions?

1030


What are global variables and explain how do you declare them?

1091


what will be maximum number of comparisons when number of elements are given?

1891


how to construct a simulator keeping the logical boolean gates in c

2247


What are the types of type qualifiers in c?

1073


Why we write conio h in c?

1015


Do you have any idea how to compare array with pointer in c?

1040


Why is c faster?

1081