Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

how to find the kth smallest element in the given list of
array elemnts.

Answer Posted / ruchi

#include<stdio.h>
#include<conio.h>
int main()
{
int a[10],i,j,n,temp;
printf("\nEnter the number of elements int he array ");
scanf("%d",&n);
printf("\nEnter the elements ");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(a[i]>a[j])
{
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
printf("\nThe smallest element is ");
for(i=0;i<n;i++)
{
printf("%d\n",a[i]);
break;
}
getch();
}

Is This Answer Correct ?    12 Yes 28 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the scope of static variables?

1119


How to delete a node from linked list w/o using collectons?

2725


Explain about block scope in c?

1034


Explain what is the heap?

1016


How do you convert strings to numbers in C?

1170


How to write a multi-statement macro?

991


why return type of main is not necessary in linux

2046


Write a program of advanced Fibonacci series.

1099


What is volatile, register definition in C

1061


How pointer is different from array?

1020


Is it better to use a macro or a function?

1101


Can you pass an entire structure to functions?

1082


How #define works?

1051


What is context in c?

886


How the c program is executed?

1080