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 will be your course of action for a push operation?
Whats s or c mean?
What functions are used in dynamic memory allocation in c?
What are the types of i/o functions?
Why is c so popular?
Why are some ANSI/ISO Standard library routines showing up as undefined, even though I've got an ANSI compiler?
Can a pointer be null?
Can a variable be both const and volatile?
Why do we use pointer to pointer in c?
a parameter passed between a calling program and a called program a) variable b) constant c) argument d) all of the above
How to delete a node from linked list w/o using collectons?
What is string function in c?
What are two dimensional arrays alternatively called as?
What is the benefit of using const for declaring constants?
In c programming write a program that will print 10 multiples of 3 except 15,18,21 using looping