Wednesday, November 24, 2010

write a program to display the position of given element in a array

implicit double precision (a-h,o-z)
    dimension A(11)
    DATA A/1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0/
    write(*,*) 'enter p'
    read(*,*) p
    i=1
    count=1
10    if(p.EQ.A(i)) then
    count=count
      write(*,*) count
    goto 20
    else
    count=count+1
    i=i+1
    goto 10  
20    endif 
    stop
    end

No comments:

Post a Comment