Code line Code explanation
Function start() { Starts the function
Println(“1”); Prints 1 since it can’t be divided by 2
Var arr = [1,2,3,5,6,7]; Defines the list used in the code later
Var odds = only Runs the function only odds.
Odds(arr);
}
Function only Odds[arr] Run the code to determine if each one is odd or
{ even
Var oddNum = arr[2] % Divides the 2nd one into the list by 2 and takes the
2 remainder
Var oddNumTwo = Divides the 4th one into the list by 2 and takes the
arr[4] % 2 remainder
Var oddNumThree = Divides the 6th one into the list by 2 and takes the
arr[6] % 2 remainder
If(oddNum == 1) { Checks if the oddNum is odd
Println(“3”); Prints the number
}
If(oddNumTwo == 1) { Check if the oddNumTwo is odd
Println(“5”); Prints the number if it is odd
}
If(oddNumThree == 1) Checks if the oddNumThree is odd
{
Println(“7”); Prints the number if it is odd
}
Println(“all these Says that all that was printed is odd
numbers are odd”);
}