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 the use of the function in c?

973


An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above

1120


can anyone please tell about the nested interrupts?

2066


When should structures be passed by values or by references?

998


What is the purpose of the statement: strcat (S2, S1)?

1080


C program to find all possible outcomes of a dice?

2281


What is the total generic pointer type?

1110


What is the maximum length of an identifier?

1137


Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......

2136


Explain how do I determine whether a character is numeric, alphabetic, and so on?

1085


What is a lvalue

1043


How many levels of indirection in pointers can you have in a single declaration?

1029


What is spaghetti programming?

1074


What is function definition in c?

1024


What is a memory leak? How to avoid it?

1262