RenanSakashita1

Program - Linear Function Simple

Sep 29th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. program linearfunction
  2.  
  3. real::a,b
  4.  
  5. print*,'Linear function --- A*X = B'
  6. print*,'A value:'
  7. read*,a
  8. print*,'B value:'
  9. read*,b
  10.  
  11. if (a .eq. 0)then
  12.    if (b .eq. 0)then   !a = 0,b = 0
  13.     print*,'X = Reals' !X = 0/0 ----> Reals
  14.   elseif (b .ne. 0)then    !a = 0,b = 4
  15.     print*,'X = Not exist' !X = 4/0 ---> Not exist
  16.   end if
  17. elseif(a .ne. 0)then  !a = 3,b = 5
  18.   print*,'X = ',b/a   !X = 5/3 ----> 1,6666...
  19. end if
  20.  
  21. end program linearfunction
Add Comment
Please, Sign In to add comment