Array methods (Sort, Reverse, IndexOf)
📖 Scenario: You are organizing a list of book titles for a small library. You want to sort the titles alphabetically, reverse the order, and find the position of a specific book.
🎯 Goal: Build a program that creates an array of book titles, sorts them, reverses the order, and finds the index of a given book.
📋 What You'll Learn
Create an array of strings called
books with these exact titles: "C# Basics", "Learn Java", "Python Guide", "Web Development", "Data Science"Create an integer variable called
index to store the position of the book "Python Guide"Use
Array.Sort to sort the books array alphabeticallyUse
Array.Reverse to reverse the order of the books arrayUse
Array.IndexOf to find the index of "Python Guide" in the reversed arrayPrint the sorted array, the reversed array, and the index of
"Python Guide"💡 Why This Matters
🌍 Real World
Sorting and searching lists is common in apps like libraries, stores, and contact lists.
💼 Career
Knowing array methods helps you manage collections of data efficiently in software development.
Progress0 / 4 steps