sort array java
You to Everyone 9:35
Good Morning Ma'amSreelakshmi to Everyone 9:35
Good Morning Ma'am
Aswathy to Everyone 9:35
Good morning ma'am
daksha foundation to Everyone 9:35
Good morning all
Amarjith As to Everyone 9:35
Good morning ma'am
Robin to Everyone 9:35
Good morning madam
Hasna to Everyone 9:36
Good morning ma'am
daksha foundation to Everyone 9:37
amarjith turn on your camera
Hasna to Everyone 9:38
yes
Robin to Everyone 9:38
no
Sreelakshmi to Everyone 9:38
yes
You to Everyone 9:38
l have fasting🙂
Robin to Everyone 9:38
l leave breakfast
You to Everyone 9:38
ok ma'am
Robin to Everyone 9:39
okay madam
daksha foundation to Everyone 9:39
amal
Amal Moncy to Everyone 9:39
football
pain some
Sreelakshmi to Everyone 9:41
yes
Hasna to Everyone 9:41
Yes ma'am
Aswathy to Everyone 9:41
yes
Amal Moncy to Everyone 9:41
yes
Robin to Everyone 9:41
yes
You to Everyone 9:41
ys ma'am
daksha foundation to Everyone 9:41
see that?
Sreelakshmi to Everyone 9:42
yes
Hasna to Everyone 9:42
Yes ma'am
You to Everyone 9:42
ys ma;am
Sreelakshmi to Everyone 9:43
yes ma'am
daksha foundation to Everyone 9:43
sreelakshmi
Sreelakshmi to Everyone 9:43
all are posted yesterday
ui
daksha foundation to Everyone 9:44
Ui or sw
You to Everyone 9:44
ui
Sreelakshmi to Everyone 9:44
Ui
yes...its difficult
You to Everyone 9:46
some difficult
Hasna to Everyone 9:46
Not ok ma'am. Java is difficult.
Aswathy to Everyone 9:46
yes ma'am
Robin to Everyone 9:46
yes , Difficult it
daksha foundation to Everyone 9:46
khayoom
amarjith
Amarjith As to Everyone 9:47
it is Difficult ma'am
daksha foundation to Everyone 9:47
we will do some questions
okay
Sreelakshmi to Everyone 9:47
ok ma'am
Aswathy to Everyone 9:47
okay ma'am
Hasna to Everyone 9:48 (Edited)
Ok ma'am
You to Everyone 9:48
ok ma'am
Sreelakshmi to Everyone 9:49
yes
daksha foundation to Everyone 9:49
sort an integer array
Sreelakshmi to Everyone 9:50
no
daksha foundation to Everyone 9:50
sort an integer array in ascending order
Aswathy
Aswathy to Everyone 9:52
yes ma'am, number is ascending 1,2,3,4,5
number is descending5,4,3,2,1
daksha foundation to Everyone 9:53
Write a Java program to sort an integer array in ascending order using a loop.
integer array
3,1,8,9,2,...
1.2,3,8,9
daksha foundation to Everyone 9:55
this is the output
Sreelakshmi to Everyone 9:56
ok ma'am
Aswathy to Everyone 9:56
Okay ma'am
Amarjith As to Everyone 9:56
ok ma'am
Hasna to Everyone 9:56
ok ma'am
You to Everyone 9:56
ok ma'am
Amal Moncy to Everyone 9:56
ok ma'am
daksha foundation to Everyone 10:16
is it done
Sreelakshmi to Everyone 10:16
no ma'am
daksha foundation to Everyone 10:16
any doubtd
daksha foundation to Everyone 10:27
hi all
did you complete this
You to Everyone 10:30
hi
Aswathy to Everyone 10:30
yes ma'am
You to Everyone 10:31
not complete
Amarjith As to Everyone 10:32
No, ma'am i don't get output
Robin to Everyone 10:32
no, l don't get output
Aswathy to Everyone 10:35
yesterday I did from google code "String array alphabetical order" , today some change code same that
Okay ma'am
daksha foundation to Everyone 10:38
3,1,8,9,2
You to Everyone 10:38
I have doubt ma'am
Hasna to Everyone 10:39
int[]numbers={3,1,8,9,2};
You deleted a Message
daksha foundation to Everyone 10:44
for (int i = 0; i < numbers.length - 1; i++){}
Robin to Everyone 10:47
hi madam
daksha foundation to Everyone 10:47
for (int i = 0; i < numbers.length - 1; i++)
{
for (int j = 0; j < numbers.length - 1 - i; j++)
{
Robin to Everyone 10:48
l want to go washroom
You to Everyone 10:48
j full form?
ok
Amarjith As to Everyone 10:49
i to j?
ok
You to Everyone 10:50
ok ma'am
daksha foundation to Everyone 10:51
0<5-1-0
0<4
for (int i = 0; i < numbers.length - 1; i++)
{
for (int j = 0; j < numbers.length - 1 - i; j++) {
if (numbers[j] > numbers[j + 1]) {
int temp = numbers[j];
numbers[j] = numbers[j + 1];
numbers[j + 1] = temp;
}
}
}
daksha foundation to Everyone 10:58
j = 0
if(0>1)
is it true or false?
Hasna to Everyone 11:00
false
Amarjith As to Everyone 11:00
i think is false.....
daksha foundation to Everyone 11:00
yes false
so the j value will be incrementing
then it is 1
1<4-0 => 1<4
after then entering the if
daksha foundation to Everyone 11:17
public class SortArray {
public static void main(String[] args) {
int[] numbers = {5, 2, 8, 1, 3}; // Sample array
// Sorting the array
for (int i = 0; i < numbers.length - 1; i++) {
for (int j = 0; j < numbers.length - 1 - i; j++) {
if (numbers[j] > numbers[j + 1]) { // Swap if the current element is greater than the next
int temp = numbers[j];
numbers[j] = numbers[j + 1];
numbers[j + 1] = temp;
}
}
}
// Printing the sorted array
System.out.println("Sorted array in ascending order:");
for (int num : numbers) {
System.out.print(num + " ");
}
}
}
Comments
Post a Comment