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 are the uses of a pointer?
What is structure of c program?
What are the different categories of functions in c?
How to write c functions that modify head pointer of a linked list?
How can I recover the file name given an open stream or file descriptor?
How do you write a program which produces its own source code as output?
Explain how can you tell whether two strings are the same?
i have a written test for microland please give me test pattern
What is a pointer in c plus plus?
Explain why can’t constant values be used to define an array’s initial size?
What is the purpose of clrscr () printf () and getch ()?
What are the 4 data types?
How can I find out if there are characters available for reading?
Explain what does the function toupper() do?
What are the features of the c language?