🔒 Closed Pls help po 3x4 array. anu po ang mali ko hindi po ako makapag lagay ng user input?

Status
Not open for further replies.

ja_mario14

Fanatic
Pahelp po. hndi ko na po alam kung saan ang mali ko. hindi po ako makapag input ng value.

eto po yung code.
=========================================================

using System;

class LabExercise12
{
static void Main() {

int row, col;
int[,] array = new int[3,4];


for(row=0;row<3;row++)
{
for(col=0;col<4;col++)
{
Console.Write("Element [{0},{1}] : \n",row,col);
array[row,col] = Convert.ToInt32(Console.ReadLine());
}
}

Console.Write("\nThe content of 3x4 array:");
for(row=0;row<3;row++)
{
Console.Write("\n");
for(col=0;col<4;col++)
Console.Write("{0}\t",array[row,col]);
}
Console.WriteLine("\n\n");
}
}


==========================================================

Ganitong output po sana yung naka-attach na image.


PS: sorry po, nilagay ko yung code as text. wala po kasi akong button nung attach code.


Thank you in advance po.

View attachment 1901670 View attachment 1901672
 
C#:
 class LabExercise12
    {
        static void Main()
        {

            int row, col;
            int[,] array = new int[3, 4];


            for (row = 0; row < 3; row++)
            {
                for (col = 0; col < 4; col++)
                {
                    Console.Write(String.Format("Element [{0},{1}] : ", row, col));
                    array[row, col] = Convert.ToInt32(Console.ReadLine());
                }
            }

            Console.Write("\nThe content of 3x4 array:");
            for (row = 0; row < 3; row++)
            {
                Console.Write("\n");
                for (col = 0; col < 4; col++)
                    Console.Write(String.Format("{0}\t", array[row, col]));
            }
            Console.WriteLine("\n\n");
            Console.ReadKey();
        }
    }
 
Status
Not open for further replies.

About this Thread

  • 1
    Replies
  • 539
    Views
  • 2
    Participants
Last reply from:
Aoshinomori

Online now

Members online
1,015
Guests online
858
Total visitors
1,873

Forum statistics

Threads
2,276,222
Posts
28,968,417
Members
1,231,173
Latest member
JJJJMMMM
Back
Top