write a program to fined second smallest and largest element
in a given series of elements (without sorting)
Answer Posted / sachin tyagi
void main()
{
int a[12],max,min1.min2,max2,i,temp;
printf("enter valu");
for(i=0;i<11;i++)
scanf(%d,&a[i]);
max=a[0];
min1=a[0];
for(i=1;i<11;i++)
{
if(max<a[i])
max=a[i];
if(min1>a[i];
min1=a[i]
}
for(i=1;i<11;i++0
{
if((max2>a[i])&&(max2!=max){
max2=a[i];
}
if((min2<a[i])&&(min2!=min1))
{
min2=a[i];}
print("small is %d and large is %d", min2,max2);
}
| Is This Answer Correct ? | 15 Yes | 13 No |
Post New Answer View All Answers
What is void pointers in c?
Describe the difference between = and == symbols in c programming?
What is the scope of an external variable in c?
Can true be a variable name in c?
What is void main ()?
What is the ANSI C Standard?
What are the types of operators in c?
can any one tel me wt is the question pattern for NIC exam
What is the meaning of typedef struct in c?
What is operator precedence?
Where in memory are my variables stored?
What are different types of operators?
Explain setjmp()?
difference between Low, Middle, High Level languages in c ?
How can I manipulate individual bits?