Wednesday, November 24, 2010

Write a program to count even and odd number between a given one dimensional array

implicit double precision (a-h,o-z)
    dimension A(10), B(10)
    DATA A/1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 68.0, 8.0, 9.0, 10.0/
    count=0
    do i=1,10
    B(i)=mod(A(i),2.0)
   
    if(B(i).EQ.0.0) then
    count=count+1

    else
    count=count
    endif
      enddo
    count1=10-count
    write(*,*) count, count1
    stop
    end

No comments:

Post a Comment