write a program to fined second smallest and largest element
in a given series of elements (without sorting)
Answer Posted / raj
#include <stdio.h>
void main()
{
int i, ar[] ={15,22,122,15,6,12};
int a,b= 0,c,ta ,tb, tc;
a =ar[0];
b = ar[1];
for (i = 0; i < 6 ;i++)
{
if(a > ar[i])
{
b = a;
a = ar[i];
}
else if(b > ar[i])
{
b = ar[i];
}
}
printf("\n %d ",b);
}
Is This Answer Correct ? | 3 Yes | 3 No |
Post New Answer View All Answers
What is indirection in c?
How will you declare an array of three function pointers where each function receives two ints and returns a float?
Why is c called c not d or e?
Explain main function in c?
Can you please explain the difference between malloc() and calloc() function?
What are the two forms of #include directive?
What is a c token and types of c tokens?
void main(int n) { if(n==0) return; main(--n); printf("%d ",n); getch(); } how it work and what will be its output...............it any one know ans plz reply
What is memory leak in c?
Describe the order of precedence with regards to operators in C.
What are pointers? What are stacks and queues?
Difference between goto, long jmp() and setjmp()?
What is the difference between exit() and _exit() function?
How do you use a 'Local Block'?
What are the data types present in c?