Advertisement
zrhans

precedenceOp.f90

Jan 10th, 2021
2,704
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. program precedenceOp
  2. ! this program checks logical operators
  3.  
  4. implicit none  
  5.  
  6.    ! variable declaration
  7.    integer :: a, b, c, d, e
  8.  
  9.    ! assigning values
  10.    a = 20  
  11.    b = 10
  12.    c = 15
  13.    d = 5
  14.  
  15.    e = (a + b) * c / d      ! ( 30 * 15 ) / 5
  16.    print *, "Value of (a + b) * c / d is :    ",  e
  17.  
  18.    e = ((a + b) * c) / d    ! (30 * 15 ) / 5
  19.    print *, "Value of ((a + b) * c) / d is  : ",  e
  20.  
  21.    e = (a + b) * (c / d);   ! (30) * (15/5)
  22.    print *, "Value of (a + b) * (c / d) is  : ",  e
  23.  
  24.    e = a + (b * c) / d;     !  20 + (150/5)
  25.    print *, "Value of a + (b * c) / d is  :   " ,  e
  26.  
  27. end program precedenceOp
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement