일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
- Mail Header injection
- Navajo alphabet
- vigenere cipher
- base16
- cookie
- AVR
- 시저 암호
- sql injection
- Pigpen Cipher
- assembly
- BASE64
- JavaScript
- Masonic Cipher
- overthewire
- Web Hacking
- burpsuit
- aslr
- Javscript
- Fortran 90
- 카이사르 암호
- webhacking
- php_extract
- Caesar Cipher
- Python
- sha1
- base32
- 비즈네르 암호
- Qrcode
- reversing
- Linux
- Today
- Total
My Drive
04. Loops 본문
1. do-loop ( increment : 옵션, default = 1 )
◦ example :
do i=1,10,2 ! begin, end, increment
write(*,*) i,i**2
enddo ! or, end do
만약, begin이 end보다 크면, increment가 주어져야 함. 그렇지 않으면 실행 안됨
◦ example :
do i=10,1 ! not executed
write(*,*) i,i**2
enddo
do i=10,1,-1 ! executed
write(*,*) i,i**2
enddo
2. while-loop
◦ example :
x=.2
do while (x.lt..95)
x=3.8*x*(1.-x)
write(*,*) x
enddo
3. 무한 루프
◦ example :
do ! "do forever". Exit required.
write(*,*) ’Enter a number’
read(*,*) x
if(x.lt.0.) exit
write(*,*) ’The square root of ’,x,’ is ’,sqrt(x)
enddo
4. 함축된 do-loop
◦ example :
write(*,*) (i,i**2,i=1,100)
아래와 동일한 결과
do i=1,10,2
write(*,*) i,i**2
enddo
i=1
do
if(i.gt.10) exit
write(*,*) i,i**2
i=i+2
enddo
5. exit : loop 종료(c의 break)
◦ example :
do i=1,327
if(a(i).gt.1.2345) exit
enddo
6. cycle : 새로운 loop 시작 (c의 continue)
◦ example :
outer: do i=1,5 ! all matrix rows
inner: do j=1,5 ! matrix columns, search loop:
! searches for first number > 0.8 in row i
if(a(i,j).gt.0.8) then
write(*,*) ’row’,i,’: column’,j,’:’,a(i,j)
cycle outer
endif
enddo inner
write(*,*) ’row ’,i,’: nothing found’
enddo outer
'programming' 카테고리의 다른 글
06. Input / Output (0) | 2014.10.27 |
---|---|
05. Decisions (0) | 2014.10.25 |
03. Expressions (0) | 2014.10.25 |
02. Data types (자료형) (0) | 2014.10.24 |
01. Fortran Syntax (0) | 2014.10.24 |