New Member FAQ | Forums | Earn Revenue


Resources Entrance Ask Experts Exam Papers Jobs English Projects Universities Colleges Courses Schools Training My India



My Profile
Active Members
TodayLast 7 Days more...



Awards & Gifts
Online Exams

Fresher Jobs


Our fresher job section is exclusively for fresh graduates! Find jobs for freshers in major Indian cities including Bangalore, Chennai, Hyderabad, Pune or Kochi

Resources


Find educational articles, blogs, discussion threads and other resources.

Colleges


Find details about any college in India or search for courses.

website counter



Selection Sort Program - Java


Posted Date:     Total Responses: 0    Posted By: Annapurna   Member Level: Gold   Points/Cash: 2   


import java.io.*;
public class SelSort {

public static void main(String[] args) throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the no. of elements: ");
int n = Integer.parseInt(br.readLine());
int a[] = new int[n];
System.out.println("Enter the elements you want to sort: ");
for(int i=0; i {
a[i] = Integer.parseInt(br.readLine());
}
for(int i=0; i {
for(int j=i+1; j {
if(a[i] > a[j])
{
int temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
System.out.println("The sorted array is: ");
for(int i=0; i {
System.out.print(a[i] + " ");
}
}
}


Project Feedbacks


No feedbacks found. Be the first to respond and make money from revenue sharing program.

Post Feedback
You must Sign In to post a feedback.
Next Project: Example of Initialization - Java
Previous Project: Adding Huge Numbers in C

Return to Project Index

Post New Project


Related Projects



Advertise Here





Contact Us   Advertise   Editors    Privacy Policy    Terms Of Use   

ISC Technologies.
2006 - 2009 All Rights Reserved.