Tuesday, August 23, 2016

Dot Product

Write a program to find the Dot Product of two vectors a and b .

  Program Another_DOt_Product
  Implicit none

    Real , dimension(3) :: a, b
   integer :: i, X, Y

   X = size(a)
   Y = size(b)

   do i = 1, X
      a(i) = i
   end do

   do i = 1, Y
      b(i) = i*2
   end do

   do i = 1, X
      Print *, a(i)
   end do

   do i = 1,Y
      Print *, b(i)
   end do

   Print*, 'Vector Multiplication :'
   print*, ' Dot Product:' , Dot_product(a,b)

end program


No comments:

Post a Comment