Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  fortran
Language: FORTRAN
Code:
program vector  
     implicit none  
     real::a,b,r,k,teta  
     integer::i  
     character(10)::answer  
     real,dimension(3)::vector1,vector2  
     print*,"Welcome to my program." 
14      print*,"Please enter the coefficients of first vector."  
     do i=1,3  
     read*,vector1(i)  
     end do  
     print*,"Now please enter the coefficients of second vector."  
     do i=1,3  
     read*,vector2(i)  
     end do  
     a=sqrt(vector1(1)**2+vector1(2)**2+vector1(3)**2)  
     b=sqrt(vector2(1)**2+vector2(2)**2+vector2(3)**2)  
     r=vector1(1)*vector2(1)+vector1(2)*vector2(2)+vector1(3)*vector2(3)  
     teta=acos(r/(a*b))  
     k=a*b*sin(teta)  
     print*,"The measure of A.B is:",r  
     print*,"The measure of A*B is:",k  
     print*,"The angel between vectors is:",teta*180/3.14,"degree"  
     print*,"TRY AGAIN? yes or no"  
     read*,answer  
     if(answer=="yes")then  
     go to 14  
     else   
     print*,"HAVE A NICE DAY."  
     end if  
     end program vector
          
Comments: