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
how could explain about job profile
How are pointers declared in c?
What is sizeof in c?
Why is c used in embedded systems?
What does a derived class inherit from a base class a) Only the Public members of the base class b) Only the Protected members of the base class c) Both the Public and the Protected members of the base class d) .c file
How can you tell whether a program was compiled using c versus c++?
What is signed and unsigned?
Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result
.main() { char *p = "hello world!"; p[0] = 'H'; printf("%s",p); }
c programs are converted into machine language with the help of a) an interpreter b) a compiler c) an operatinf system d) none of the above
the maximum length of a character constant can be a) 1 character b) 8 characters c) 256 chaacters d) 125 characters
What is the use of gets and puts?
Is javascript written in c?
For what purpose null pointer used?
Process by which one bit pattern in to another by bit wise operation is?