I am assuming that user_val is an inputted variable and a whole number (int)...
user_val = int(input("Enter a number: "))
if user_val < 0:
print("negative")
else:
print("non-negative")
Each site could be for a different region for Brainly mainly because I just checked and one of the other Brainly sites had a lot more different people having questions in different languages.
I have the Xbox series X, cyber
Answer:
Explanation:
The following code is written in Java and like asked in the question, it is a function that takes in an ArrayList of Integers as a parameter and uses selection sort to sort the array.
public static void selectSort(ArrayList<Integer> list) {
for (int i = 0; i < list.size() - 1; i++)
{
int index = i;
for (int j = i + 1; j < list.size(); j++){
if (list.get(j) < list.get(index)){
index = j;
}
}
int smallerNumber = list.get(index);
list.set(index, list.get(i));
list.set(i, smallerNumber);
}
}
Answer:
int k;
double d;
char s[10];
cin >> k >> d >> s;
cout << s << " " << d << " " << k << "\n" << k << " " << d << " " << s;
Explanation
First Step (declare K, d, s) so they can store a integer
int k;
double d;
char s[10];
Second Step (read in an integer, a real number and a small word)
cin >> k >> d >> s;
Third Step ( print them out )
cout << s << " " << d << " " << k << "\n" << k << " " << d << " " << s;