+ 23
I need help with this exercise : Print the elements of array in reverse order
TASK : Given an array, of 'n' integers. Print the elements of array in reverse order as a single line of space-separated numbers. NOTE : The first line contains an integer, 'n' (the size of our array). The second line contains 'n' space-separated integers describing array's elements.
27 Antworten
+ 2
Here is my try
Update [bug fixed]
https://code.sololearn.com/WruPfH33OdNU
+ 17
I will try to do ths exercise in Java. 😊
I started to learn C# and I'm trying
to do a task in it, but it's not good !! 🙃
+ 17
It's not completely clear to me
in the task set ?! 🤔
That's why I set it up to try
and find a solution, 😉
and surely Java is more interesting, 😊
at least to me always !! 👍😆
+ 17
Input Format :
The first line contains an integer,
N => (the size of array), 1 < N < 1000
The second line contains N space-separated integers describing array A's elements.
Input : 4 == N Size of array => first line,
ENTER,
1 4 3 2 == array elements,
SUBMIT
+ 17
Here We Go !!
https://code.sololearn.com/cyOSi9OosU2X/?ref=app
+ 16
https://code.sololearn.com/cVMeqhA96ePy/?ref=app
+ 16
It's not like in the task,
but I'll make it better !! 😆
https://code.sololearn.com/Wz8wDtWQxwCU/?ref=app
+ 15
https://code.sololearn.com/WAlTS1o3B7Q7/?ref=app
+ 15
@John Dooe
If you have any suggestions
for these codes,
please write to me,
thank you. 😊😆
+ 14
Now Your answer
will be The Best !! 😆
+ 14
I'll try to do a solution with the method,
but again in Java !! 😎
+ 13
@Bihan Samarasinghe
Just : Tap Here To Load More
https://code.sololearn.com/cyOSi9OosU2X/?ref=app
+ 6
Here it is in C# :
https://code.sololearn.com/cBmckUcJ2ZRz/?ref=app
+ 3
Will use reverse() with JavaScript but then the output will be 1,2 instead of 1 2 which is expected, I think there is also reverse() available for Java check it out.
To avoid the comma you shouldn't output the final result as an array I think!
+ 3
😊@Danijel Ivanović thanks man!!✌🏾️😎
😀😀
+ 3
Recursively
https://code.sololearn.com/WQeU4DuRoMY4/?ref=app
+ 3
@dim_kno Thanks but using in instead of make thing worse,
I had already declared var i that why didn't include it in the for loop,
The problem come from the calculation for sure!
+ 3
@dim_knp maybe, but I'm iFan😊😀
The problem is with the app I think it too buggy on iOS,
The crash when answering some drag and drop question
On question in the learning section.
I've tested the app on android it way better.
I broke that android phone 2 days ago😔, hope to fix it next week😊
+ 3
@dim_knp ont really going back I never been there that device purpose is meanly to test android apps once I start writing Java apps, I stop learning Java to concentrate on web dev for now
+ 2
😊, when I took a peek a Java and C# I found them quite similar but Java was more interesting.
Here use or modify this function it will do the trick.
Will post a working code of it using js 😊.
function reverseInput(str) {
var reverse = " ", i=0;
for (if of str) {
reverse = i + reverse;
}
return reverse
}