Answer to Question #309752 in C# for chi

Question #309752

Machine Problem 5.4.

Write a program using two-­‐dimensional arrays that determines the ODD numbers among the12 input values typed fromthe keyboard and prints the list of these ODD numbers.


Sample input/output dialogue: 

Enter twelve numbers: 8 9 10 7 25 30 69 101 798 10111 10023

Odd numbers are: 9 7 25 69 101 10111 10023


1
Expert's answer
2022-03-11T07:24:37-0500

Here is my program:

  static void Main(string[] args)
        {
            int[,] arr = new int[12,1];
            Console.WriteLine("Enter twelve numbers: ");
            for(int i = 0; i < arr.Length; i++)
            {
                arr[i,0] = Int32.Parse(Console.ReadLine());
            }
            Console.Write("Odd numbers are: "); 
            foreach(int i in arr)
            {
                if (i % 2 != 0)
                {
                    Console.Write(i + " ");
                }
            }
        }

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS