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
How can I insert or delete a line (or record) in the middle of a file?
Why is python slower than c?
Do pointers take up memory?
What is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?
Explain the term printf() and scanf() used in c language?
What is array of pointers to string?
I need testPalindrome and removeSpace
#include
What are examples of structures?
What is wrong with this code?
all c language question
what is the differnce between programing langauge and tool? is sas is a programing langauge r tool?
Why cant I open a file by its explicit path?
What is assignment operator?
What is sizeof return in c?
How can I convert a number to a string?