+ 1
Print the first N odd number in TextArea1 and even number in TextArea2
2 Respuestas
0
Step 1: Create two String variables initialized with "" (blank). One for OddNumbers and another for EvenNumbers.
Step 2: Run a loop from 1 to N.
Step 3: On each iteration of the loop check the current number. If it's Odd then concatenate it to OddNumbers string otherwise concatenate to EvenNumbers string.
Step 4: After you break out of the loop set OddNumbers string to textArea1 and EvenNumbers string to textArea2.
Note: You can use StringBuilder class which supports append method which is less memory and time expensive than concatenation for String.
0
explain with coding