+ 1

Print the first N odd number in TextArea1 and even number in TextArea2

5th Feb 2017, 5:24 AM
Nikunj Gupta
Nikunj Gupta - avatar
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.
10th Feb 2017, 3:24 AM
Tahmid Choyon
Tahmid Choyon - avatar
0
explain with coding
21st Feb 2017, 4:50 PM
Nikunj Gupta
Nikunj Gupta - avatar