Matriks Ordo (Pengurangan)

Posted by Budi Arieyanto | Posted in | Posted on 03.07

#include <iostream.h>
#include <conio.h>

main()
{
    int a[20][20];
   int b[20][20];
   int c[20][20];
   int i,j;
   for(i=1;i<=2;i++)
   {
       for(j=1;j<=2;j++)
      {
          cout<<"A["<<i<<"."<<j<<"] : ";
         cin>>a[i][j];
      }
   }
   cout<<'\n';
   for(i=1;i<=2;i++)
   {
       for(j=1;j<=2;j++)
      {
          cout<<"B["<<i<<"."<<j<<"] : ";
         cin>>b[i][j];
      }
   }
   cout<<'\n';
   for(i=1;i<=2;i++)
   {
       for(j=1;j<=2;j++)
      {
         c[i][j]=a[i][j]-b[i][j];
      }
   }
   for(i=1;i<=2;i++)
   {
       for(j=1;j<=2;j++)
      {
         cout<<"C["<<i<<"."<<j<<"] : "<<c[i][j]<<endl;
      }
   }
   getch();
}

Comments (0)

Posting Komentar