All pastes #719177 Raw Edit

Unnamed

public text v1 · immutable
#719177 ·published 2007-09-29 00:19 UTC
rendered paste body
      program six
* Calculator
      character*3 oper,yesno
      print*, "***Calculator 2007 powered by haris***"
      print*, "~~~~Welcome~~~~"
      yesno='y'
      do while (yesno.eq.'y')
      print*,"Give a number:"
      read*,a
      print*," Choose the operation you want to do (+,-,*,/,ln,exp,sin,c
     +os):"
      read*,oper
      if(oper.eq.'ln')then
                     r=alog(a)
      else if(oper.eq.'exp') then
                     r=exp(a)
      else if(oper.eq.'sin') then
                     r=sin(a)
      else if(oper.eq.'cos') then
                     r=cos(a)
      else
                     print*,"Give second number:"
                     read*,b
                     if(oper.eq.'+') then
                                     r=a+b
                     elseif(oper.eq.'-') then
                                     r=a-b
                     elseif(oper.eq.'*') then
                                     r=a*b
                     elseif(oper.eq.'/') then
                                     r=a/b
                     else
                                     print*,"Not defined operation"
                                     r=0
                     endif

      endif
                     print*,r
      print*,"Type y to continue"
      read*,yesno
      enddo
      end