Advertisement
a3f

Matrix Addition

a3f
May 5th, 2012
2,791
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. REM Gam3 masfofteen
  2. REM By Ahmed Fatoum
  3.  
  4. 'el goz2 dah thabet 3alatol
  5. Dim A(3,3) 'ne3araf 3 masfofat dimension'atha 3x3
  6. Dim B(3,3)
  7. Dim C(3,3)
  8.  
  9.  
  10. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  11. 'taree2a number 1
  12. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  13.  
  14. for i = 1 to 3 'nelef 3l sfof kolaha
  15.     for j = 1 to 3 'nelef 3l a3meda ele fel sfof
  16.         input A(i,j) 'neda5al qeemet el 3onsor ele 3aleeh el door (i,j)
  17.     next j
  18. next i
  19.  
  20. for i = 1 to 3 'nafs el kalam
  21.     for j = 1 to 3
  22.         input B(i,j)
  23.     next j
  24. next i
  25.  
  26. for i = 1 to 3 'nafs el kalam bardak
  27.     for j = 1 to 3
  28.         C(i,j) = A(i,j) + B(i,j)
  29.         print C(i,j) 'nekteb qeemet el 3onsor, momken nesta3'na 3an keda 5ales we ne3mel print A(i,j) + B(i,j) 3alatol
  30.     next j
  31.     print 'ama y5las el saf, ne2leb 3l satr ele b3deeh
  32. next i
  33.  
  34. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  35. 'taree2a number 2
  36. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  37.  
  38. for i = 1 to 3 'nelef 3l sfof kolaha
  39.     for j = 1 to 3 'nelef 3l a3meda ele fel sfof
  40.         read x
  41.         A(i,j) = x
  42.     next j
  43. next i
  44.  
  45. for i = 1 to 3 'nafs el kalam
  46.     for j = 1 to 3
  47.         read x ' maynfa3shi read B(i,j) 3alatol am ben7oteha fe x
  48.         B(i,j) = x
  49.     next j
  50. next i
  51.  
  52. for i = 1 to 3 'nafs el kalam bardak
  53.     for j = 1 to 3
  54.         C(i,j) = A(i,j) + B(i,j)
  55.         print C(i,j), 'nekteb qeemet el 3onsor, momken nesta3'na 3an keda 5ales we ne3mel print A(i,j) + B(i,j) 3alatol
  56.     next j
  57.     print
  58. next i
  59.  
  60. DATA 1,-2,3,643,7,37,3,75,-37,53,73,7,35,-753,73,-57,56,7,-897,5,2012 'ay qiyam
  61. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  62. 'taree2a asra3 shwya (thanks to islam negm)
  63. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  64. DIM temp(4,4)
  65. for matrix = 1 to 3
  66.     for i = 1 to 3
  67.         for j = 1 to 3
  68.             x = 0
  69.             if matrix <> 3 then input x
  70.                 temp(i,j) = temp(i,j) + x
  71.             if matrix = 3 then print temp(i,j),
  72.         next j
  73.         if matrix = 3 then print
  74.     if matrix <> 2 then
  75.     print "next matrix"
  76.     else
  77.     print "elnateega"
  78.     end if
  79.     next i
  80.    
  81. next matrix
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement