part1c - END IF...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
PROGRAM part1c IMPLICIT NONE INTEGER::x1,y1,x2,y2,a,b,n WRITE(*,*)"Enter the coordinates of the first point:" READ(*,*)x1,y1 WRITE(*,*)"Enter the coordinates of the second point:" READ(*,*)x2,y2 a = x2-x1 IF (a<0)THEN WRITE(*,*)"Invalid coordinates for a were entered." STOP END IF b = y2-y1 IF(b<0)THEN WRITE(*,*)"Invalid coordinates for b were entered." STOP
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: END IF WRITE(*,'(A,I10,A,I2,A,I2,A,I2,A,I2,A)')"There are ",n(a,b)," paths & &between (",x1," ,",y1," ) and (",x2," ,",y2," )." END PROGRAM RECURSIVE INTEGER FUNCTION n(a,b) RESULT(path) IMPLICIT NONE INTEGER, INTENT(IN)::a,b INTEGER::path IF(a==0 .OR. b==0)THEN path=1 ELSE path=n(a-1,b) + n(a,b-1) END IF END FUNCTION n...
View Full Document

This note was uploaded on 07/22/2010 for the course MAE 112 taught by Professor Freeh during the Spring '10 term at North Country Community College.

Ask a homework question - tutors are online