program convert
!This example
convert pence to pounds and pence.
implicit none
integer::pounds,pence,total
character::name*14
print*,'what
is your name?'
read*,name
print*,'hi',name,'enter your value in pence here'
read*,total
!total=100*pounds+pence
pence=mod(total,100)
pounds=(total-pence)/100
print*,'the
total money is',pounds,'pounds :',pence,'pence'
end program convert
2. FORTRAN PROGRAM TO SWAP VALUE
program swap
implicit none
integer ::a,b,c
print *,'enter two numbers a and b'
read *, a,b
print *, ' a is ',a, ' and b is ',b
c=a
a=b
b=c
print *, 'I have swapped them - a is now ',a, ' and b is now
',b
end program swap
No comments:
Post a Comment