Return to Snippet

Revision: 67729
at October 22, 2014 18:00 by chema_ar


Initial Code
program triangle_pattern

integer :: i = 0;
integer :: j = 0;
integer :: n = 3;

do while (i<n)
   j = 0;
   do while (j<n)
       if (j>=i) then
          write(*,"(A)",advance="no") " *"
       else
           write(*,"(A)",advance="no") " ."
       end if
       j=j+1;
   end do
    i = i +1;
    print *,""
end do
read *,

end program triangle_pattern

Initial URL


Initial Description
This is a piece of code to draw a triangle pattern in the upper diagonal elements. It is a basic exercise of programming.

Initial Title
Triangle pattern

Initial Tags


Initial Language
Fortran