Java 30 Days of Code- Day 7 - Arrays

In previous articles we have covered a lot of topics. In this article we will cover the most important topic, there are 90% chances you will see this topic in your question paper. If you have mastered the concept of Array, any programming language is easy to learn afterwards.

Java 30 Days of Code - day 7 - Arrays

Problem statement - Print an array in the reverse order.

Input - 
4
1 2 3 4

Output
4 3 2 1

Program -
for(int i=n-1; i>=0; i--){
            System.out.print(arr[i]+" ");
        }

Explanation -
  • Loop is what needs to be correct here. It starts with n-1 ends at 0 and i--



Comments

Popular posts from this blog

Azure Tutorials Series - Azure Networking

Coforge Interview Questions | Automation Testing profile

Testing in CI/CD