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 the use of the function in c?
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
can anyone please tell about the nested interrupts?
When should structures be passed by values or by references?
What is the purpose of the statement: strcat (S2, S1)?
C program to find all possible outcomes of a dice?
What is the total generic pointer type?
What is the maximum length of an identifier?
Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......
Explain how do I determine whether a character is numeric, alphabetic, and so on?
What is a lvalue
How many levels of indirection in pointers can you have in a single declaration?
What is spaghetti programming?
What is function definition in c?
What is a memory leak? How to avoid it?