find second largest element in array w/o using sorting
techniques? use onle one for loop.
Answer Posted / ramesh
this is to largest element in an array using one loop concept:
for(int i=0;i<=arr.length;i++)
{
if(a[i]>a[i+1])//if first position element is large we want swap that element
{
t =a[i];
a[i] =a[i+1];
a[i+1]=t;
}
printf("%d",a[i+1]);
by
97894 33227
| Is This Answer Correct ? | 1 Yes | 3 No |
Post New Answer View All Answers
Where are c variables stored in memory?
What is echo in c programming?
any restrictions have on the number of 'return' statements that may be present in a function. a) no restriction b) only 2 return statements c) only 1 return statements d) none of the above
can we implement multi-threads in c.
Explain goto?
write a program to print the consecutive repeated character from the given string... input string is : hhhhjkutskkkkkggggj output should be like this: hhhhkkkkkgggg anyone help me...
any C program contains only one function, it must be a) void () b) main () c) message () d) abc ()
Why is c called c?
Explain how can I write functions that take a variable number of arguments?
What do you mean by dynamic memory allocation in c? What functions are used?
What is register variable in c language?
What are the types of pointers?
How do you view the path?
What does nil mean in c?
How can you avoid including a header more than once?