I Have To Write A Program Of Sorting Of Arrays. Can Any One Help?
Write a program that takes input from user and store in an array of size 10 and arrange them in ascending order.
1 Answer - Sort by: Date | Rating
Void Main( )
{
Int a,b,k,j,I, temp, min;
Array x[10];
For (int a = 0; a<10; a++)
{// Enter 10 numbers one by one in an array
printf("Enter no. Of elements in the list:- ");
scanf ("%d",&b);
//storing numbers in an array
x[a]=b;
}
for (i=1;i<10;i++)
{
// assuming that the first number is smaller
min=x[i];
k=i;
for (j=(i+1);j<10;j++)
{
// Checking the next number is smaller of not
if (a[j]
{
//storing the smaller number in the int min
min=a[j];
k=j;
}
// swap current element with next element in the array
// if the current element is greater
temp=a[k];
a[k]=a[i];
a[i]=temp;
}
}
{
Int a,b,k,j,I, temp, min;
Array x[10];
For (int a = 0; a<10; a++)
{// Enter 10 numbers one by one in an array
printf("Enter no. Of elements in the list:- ");
scanf ("%d",&b);
//storing numbers in an array
x[a]=b;
}
for (i=1;i<10;i++)
{
// assuming that the first number is smaller
min=x[i];
k=i;
for (j=(i+1);j<10;j++)
{
// Checking the next number is smaller of not
if (a[j]
{
//storing the smaller number in the int min
min=a[j];
k=j;
}
// swap current element with next element in the array
// if the current element is greater
temp=a[k];
a[k]=a[i];
a[i]=temp;
}
}
0
0
- How Do You Make A Spongebob With Regular String?
- What Are The Advantages And Disadvantages Of Representing Between Variable In A Table?
- When Did Uganda Get Its Independence?
- Explain Any Two Advantages Of A Database Systems?
- Explain File Management Systems Using File-based Approach?
- Do You Need Any Qualifications To Be A Model?
- How To Draw Flow Chart To Check Whether Given String Is Palindrome Or Not?
- What Are Different Versions Of Html?
- In An Array Declaration,this Indicates The Number Of Elements That The Array Will Have?
- What Is Needed To Run A PHP Script?
- Writing Of Data To A Transaction Log Is Which ACID Property?
- When Did Japan Get Independence?
- What Is The Main Disadvantage Of Recursion?
- How Are Records Deleted To Ensure The Integrity And Consistancy Of A Database?
- What Is Object Based Logical Model?
- What Is Difference Between Html And Rss Reader?
- What Are The Higher Normal Forms In Database?
- How To Construct A Flowchart That Will Compute And Print The Sum And Average Of Three Numbers?
- What Do I Do On Meez If It Says Your Input Is Not Correct And It Is?
- How Do I Enable Java Script Onto My Browser. My Cellphone Is A LG - LW310?
- What's An Equation For A Line That Has An X-int Of (6,0) And Y-int Of (0,4)?
- Data In MS Access Table Is Read Only - Need To Change So Can Edit Or Delete?
- How Can I Write The Program The Greatest The The Element In Array In C?
- What Is The Oldest Database Model?
- What Is The Oldest And Simplest Of The 5 Database Models?
- How To Write A Program To Enter 5 Numbers And Store In Arrays?
- Why Does Using Arrays With Loops Improve Program Efficiency?
- How Do Arrays Make Program Development More Efficient ?
- Can You Write Down A Procedure For Sorting 5 Names In Alphabetical Order?
- How I Write A Program In C#?
- How Can I Write A C++ Program?

New Comment - Comments are editable for 5 min.