Don't repeat yourself (DRY, or sometimes do not repeat yourself) is a principle of software development aimed at reducing repetition of software patterns,[1] replacing it with abstractions or using data normalization to avoid redundancy.
Answer:
- using System;
- public class Program
- {
- public static void Main()
- {
- Console.WriteLine("Enter number of students: ");
- int num = Convert.ToInt32(Console.ReadLine());
- string [] firstName = new string[num];
- string [] lastName = new string[num];
-
- for(int i=0 ; i < num; i++){
- Console.WriteLine("Enter first name: ");
- firstName[i] = Console.ReadLine();
-
- Console.WriteLine("Enter last name: ");
- lastName[i] = Console.ReadLine();
- }
-
- for(int j=0; j < num; j++){
- Console.WriteLine(lastName[j] + "," + firstName[j]);
- }
- }
- }
Explanation:
Firstly, prompt user to enter number of student to be stored (Line 6- 7). Next, create two array, firstName and lastName with num size (Line 8-9).
Create a for-loop to repeat for num times and prompt user to enter first name and last name and then store them in the firstName and lastName array, respectively (Line 11 - 17).
Create another for loop to traverse through the lastName and firstName array and display the last name and first name by following the format given in the question (Line 19 - 21).
There mag be water on Mars but it’s not very easy to spot, but that is besides the point,
Mars is a smaller planet then Earth, thus it has less gravity, meaning when water evaporates into the atmosphere of the planet the water slowly escapes into space, so there is less and less water on the planet.
Hope this helps!
Answer:
Explanation:
Find attached the solution to the question