Wednesday, 8 August 2018

contoh script java menampilkan nilai matrik


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication10
{
    class Program
    {
        static void Main(string[] args)
        {
            int[][] matriks = new int[3][];
            Console.WriteLine("masukkan nilai matriks");
            for (int i = 0; i < matriks.Length; i++)
            {
                matriks[i] = new int[3];
                for (int j = 0; j < matriks[i].Length; j++)
                {
                    Console.Write("matriks[{0}][{1}]= ", i, j);
                    matriks[i][j] = int.Parse(Console.ReadLine());
                }
            }
            Console.WriteLine();
            Console.WriteLine("menampilkan nilai matriks");
            for (int i = 0; i < matriks.Length; i++)
            {
                for (int j = 0; j < matriks[i].Length; j++)
                {
                    Console.Write("{0}", matriks[i][j]);
                }
                Console.WriteLine();
            }
            Console.Read();
        }
    }

}




     Download script disini





No comments:

Post a Comment