ICSE Class 10 Computer Applications
Question 29 of 30
Solved 2024 Question Paper ICSE Class 10 Computer Applications — Question 5
Back to all questionspublic class Pincode
{
public static void main(String args[]) {
int[] arr = {110061, 110001,
110029, 110023,
110055, 110006,
110019, 110033};
for (int i = 0; i < 7; i++)
{
int idx = i;
for (int j = i + 1; j < 8; j++)
{
if (arr[j] < arr[idx])
idx = j;
}
int t = arr[i];
arr[i] = arr[idx];
arr[idx] = t;
}
System.out.println("Sorted Array:");
for (int i = 0; i < 8; i++)
{
System.out.print(arr[i] + " ");
}
}
}