SHARE
TWEET

72

starm100 Dec 8th, 2018 120 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. program n72
  2. real::x0,xk,dx,y0,yk,dy,y,x,a,b
  3. integer::i,j,imax,jmax
  4. write(*,*) 'Input x0,xk,dx,y0,yk,dy,a,b'
  5. read(*,*) x0,xk,dx,y0,yk,dy,a,b
  6. jmax=nint((yk-y0)/dy+0.5)+1 !nint- округление к целому числу
  7. imax=nint((xk-x0)/dx+0.5)+1
  8. do j=1,jmax
  9.     y=yk-(j-1)*dy
  10.     do i=1,imax
  11.         x=x0+(i-1)*dx
  12.         if ((abs(x)+abs(y)>a) .AND. (abs(x)+abs(y)<b) .AND. ((y>=abs(x)) .OR. (y<-abs(x))))  then ! условие
  13.             write(*,'(a\)') ' /' ! (\)-без перехода на новую строку
  14.         else
  15.             write(*,'(a\)') ' .'
  16.         end if
  17.     end do
  18.     print*,' ' !переход на новую строку
  19. end do
  20. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top