Posted By

chema_ar on 10/22/14


Tagged

loops cross f90


Versions (?)

Cross


 / Published in: Fortran
 

This is a basic program to print out a cross using loops. Code should be improved and protected.

  1. program cross
  2. integer :: n = 9;
  3. integer :: i = 0;
  4. integer :: j = 0;
  5. do while (i<n)
  6. j = 0;
  7. do while (j<n)
  8. if (i==j .OR. (n-i-1==j)) then
  9. write(*,"(A)",advance="no") " *"
  10. else
  11. write(*,"(A)",advance="no") " ."
  12. end if
  13. j= j+1;
  14. end do
  15. i = i + 1;
  16. print*,""
  17. end do
  18. read *,
  19. end program cross

Report this snippet  

You need to login to post a comment.