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
What is scope of variable in c?
Why isn't any of this standardized in c? Any real program has to do some of these things.
What is the use of sizeof?
Is there a way to switch on strings?
Differentiate between null and void pointers.
What would be an example of a structure analogous to structure c?
Write programs for String Reversal & Palindrome check
What is array of pointers to string?
Discuss the function of conditional operator, size of operator and comma operator with examples.
what does static variable mean?
How can I remove the trailing spaces from a string?
process by which one bit patten in to another by bit wise operation is? (a) masking, (b) pruning, (c) biting, (d) chopping,
Write a C Program That Will Count The Number Of Even And Odd Integers In A Set using while loop
Explain how does flowchart help in writing a program?
Multiply an Integer Number by 2 Without Using Multiplication Operator