Membuat perkalian matrik menggunakan PHP


Disini kita akan mengalikan matrik berordo 2×2 dengan 2×1, langsung aja kalo yang pake adobe dreamweaver ketik langsung. sorry gak ngasih langsung yang bisa di copas, sekalian belajar ngetik biar gak ngetik cotok ayam 😀

Pertama beri nama file dengan nama ” matrik.php ”

kalo udah buat file kedua dengan nama ” rumus.php ”

sukses ?? semoga membantu

Advertisements

9 thoughts on “Membuat perkalian matrik menggunakan PHP

    • kalo di php saya belum nyoba sist,
      kalo di C++ pernah, ini scriptnya

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

      namespace ConsoleApplication14
      {
      class Program
      {
      static void Main(string[] args)
      {
      int hasil;
      int[,] M1 = new int[3, 3];

      for (int n = 0; n < 3; n++)
      {
      for (int m = 0; m < 3; m++)
      {
      Console.Write("M1[" + n + "][" + m + "] : ");
      M1[n, m] = Convert.ToInt16(Console.ReadLine());
      }
      Console.WriteLine();
      }

      hasil = (M1[0,0] * M1[1,1] * M1[2,2]
      + M1[0,1] * M1[1,2] * M1[2,0]
      + M1[0,2] * M1[1,0] * M1[2,1])

      – (M1[0,2] * M1[1,1] * M1[2,0]
      + M1[0,0] * M1[1,2] * M1[2,1]
      + M1[0,1] * M1[1,0] * M1[2,2]);

      Console.WriteLine("Hasil : " + hasil);

      Console.ReadLine();
      }
      }
      }

      Like

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s