|
Revision 767, 0.5 kB
(checked in by jbking, 6 years ago)
|
|
lang/fortran/misc/*.f: added doukaku posted code
|
| Line | |
|---|
| 1 | integer wb |
|---|
| 2 | |
|---|
| 3 | write(*,*) 'Input your height(cm)?' |
|---|
| 4 | read(*, *) h |
|---|
| 5 | write(*,*) 'Input your weight(cm)?' |
|---|
| 6 | read(*, *) w |
|---|
| 7 | |
|---|
| 8 | h = h / 100. |
|---|
| 9 | bmi = w / h ** 2 |
|---|
| 10 | wb = 22. * h ** 2 |
|---|
| 11 | |
|---|
| 12 | write(*, 100) bmi |
|---|
| 13 | 100 format('your BMI value is ', f4.1) |
|---|
| 14 | write(*, *) 'i think' |
|---|
| 15 | if(bmi.lt.20.) then |
|---|
| 16 | write(*, *) 'eat more!' |
|---|
| 17 | else if(bmi.ge.20..and.bmi.lt.24.) then |
|---|
| 18 | write(*, *) 'no problem' |
|---|
| 19 | else if(bmi.ge.24..and.bmi.lt.26.5) then |
|---|
| 20 | write(*, *) 'you need attention' |
|---|
| 21 | else |
|---|
| 22 | write(*, *) '...' |
|---|
| 23 | end if |
|---|
| 24 | |
|---|
| 25 | write(*, *) 'your best weight is', wb, 'kg' |
|---|
| 26 | |
|---|
| 27 | end |
|---|
| 28 | |
|---|