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 static memory allocation? Explain

626


Why main is used in c?

581


write a program for the normal snake games find in most of the mobiles.

1781


What Is The Difference Between Null And Void Pointer?

636


write a c program to calculate sum of digits till it reduces to a single digit using recursion

2713






What are the main characteristics of c language describe the structure of ac program?

604


process by which one bit patten in to another by bit wise operation is? (a) masking, (b) pruning, (c) biting, (d) chopping,

1882


Tell me can the size of an array be declared at runtime?

592


write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.

3498


Explain why C language is procedural?

766


What are the types of c language?

549


What is 2c dna?

599


any C program contains only one function, it must be a) void () b) main () c) message () d) abc ()

689


Write a program to compute the similarity between two strings - The program should get the two strings as input - Then it will output one single number which is the percentage of similarity between the two strings

2243


What is actual argument?

585