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
List the difference between a "copy constructor" and a "assignment operator"?
Why is c faster?
What is actual argument?
Explain what are linked list?
What is the use of sizeof () in c?
What is wrong with this statement? Myname = 'robin';
Difference between Shallow copy and Deep copy?
Which is better oop or procedural?
write a c program to do the following: a) To find the area of a triangle. b) To convert the temperature from Fahrenheit to Celsius. c) To convert the time in hours : minutes : seconds to seconds.
Function which gives a pointer to a binary trees const an integer value at each code, return function of all the nodes in binary tree.?
Where can I get an ansi-compatible lint?
Are the outer parentheses in return statements really optional?
count = 0; for (i = 1;i < = 10; i++);count = count + i; Value of count after execution of the above statements will be a) 0 b) 11 c) 55 d) array
Tell me is null always defined as 0(zero)?
What is static and auto variables in c?