fork(4) download
  1. program fizzbuzz
  2. implicit none
  3. integer ::i
  4.  
  5. ! Loop through integers 1 through 100
  6. ! Multiples of 3 print Fort
  7. ! Multiples of 5 print Ran
  8. ! Multiples of both print FortRan
  9. ! 15 is the lowest common multiple of 3, and 5
  10. ! and thus is a shortcut to FortRan
  11.  
  12. do i=1,100
  13. if (MODULO(i, 15) == 0) then
  14. write (*,'(A8)') 'FortRan'
  15. else if (MODULO(i, 3) == 0) then
  16. write (*,'(A8)') 'Fort'
  17. else if (MODULO(i, 5) == 0) then
  18. write (*,'(A8)') 'Ran'
  19. else
  20. write (*,'(I8)') i
  21. end if
  22. end do
  23.  
  24. end program fizzbuzz
  25.  
Success #stdin #stdout 0s 4032KB
stdin
Standard input is empty
stdout
       1
       2
    Fort
       4
     Ran
    Fort
       7
       8
    Fort
     Ran
      11
    Fort
      13
      14
 FortRan
      16
      17
    Fort
      19
     Ran
    Fort
      22
      23
    Fort
     Ran
      26
    Fort
      28
      29
 FortRan
      31
      32
    Fort
      34
     Ran
    Fort
      37
      38
    Fort
     Ran
      41
    Fort
      43
      44
 FortRan
      46
      47
    Fort
      49
     Ran
    Fort
      52
      53
    Fort
     Ran
      56
    Fort
      58
      59
 FortRan
      61
      62
    Fort
      64
     Ran
    Fort
      67
      68
    Fort
     Ran
      71
    Fort
      73
      74
 FortRan
      76
      77
    Fort
      79
     Ran
    Fort
      82
      83
    Fort
     Ran
      86
    Fort
      88
      89
 FortRan
      91
      92
    Fort
      94
     Ran
    Fort
      97
      98
    Fort
     Ran