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
What is %d used for?
What is static function in c?
Why do we use null pointer?
Can you think of a logic behind the game minesweeper.
Device an algorithm for weiler-atherton polygon clipping, where the clipping window can be any specified polygon
How do you use a pointer to a function?
Explain what are global variables and explain how do you declare them?
Can I initialize unions?
What are global variables and explain how do you declare them?
what will be maximum number of comparisons when number of elements are given?
how to construct a simulator keeping the logical boolean gates in c
What are the types of type qualifiers in c?
Why we write conio h in c?
Do you have any idea how to compare array with pointer in c?
Why is c faster?