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 language is c written?
What is the difference between text and binary modes?
What are the different types of C instructions?
How can I pad a string to a known length?
Write a factorial program using C.
What is use of integral promotions in c?
How are structure passing and returning implemented?
What is #include stdio h?
How can I do graphics in c?
With the help of using classes, write a program to add two numbers.
What was noalias and what ever happened to it?
What is the general form of #line preprocessor?
Dont ansi function prototypes render lint obsolete?
Do string constants represent numerical values?
Why does notstrcat(string, "!");Work?