What is the output of the code given below?
A. 1 2 3
B. 3 2 1
C. 1 3 2
D. 2 1 3
Code:
void setup() {
Serial.begin(9600);
}
void loop() {
int i, j, n=3, temp;
int a[3]={2, 1, 3};
for(i=0;i<n-1;i++) {
for(j=0;j<n-1-I;j++) {
if(a[j]>a[j+1]) {
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
}
for(i=0;i<n;i++) {
Serial.print(a[i]);
Serial.print(“ ”);
}
}
B. 3 2 1
C. 1 3 2
D. 2 1 3