Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
program ex18a
! this program calculate the value of y
integer::x,y
read*, x
if (x>2) then
y = -2+3*x
else
y = 8+x**2
end if
print*, y
end program ex18a
program ex20
integer::a,b,c,d
read *, a,b
print *, 'a=' ,a, 'b=',b
if(a<b) then
c=2*a*b
Print *, '2*product=' ,c
else
d=2*(a+b)
print *, '2 sum=',d
end if
end program ex20
PROGRAM bubbleSort
implicit none
Integer :: row, col, i, ii, iii, temp
integer, dimension(:,:), allocatable :: myarray
Allocate(myarray(1:row, 1:col))
DO i =1, row
READ(1,*) myarray(i, :)
do ii =1, row-1
do iii =1, row- i-1
if (myarray(i,iii)> myarray(i,iii+1)) then
temp = myarray(i,iii)
myarray(i,iii+1) = temp
end if
end do
end do
END DO
DO i = 1, row
write(*,*) myarray(i, :)
END DO
END program bubbleSort
program j
!maximum value of three numbers
integer::a,b,c
read*,a,b,c
print*,'a=',a
print*,'b=',b
print*,'c=',c
print*,
if (a>b)then
if(a>c)then
max=a
else
max=c
end if
end if
if(b>c)then
max=b
else
max=c
end if
print*,'max value of 3 numbers is',max
end program j
program prob3
!this program between low numbers and high that are divisible by numbers
integer ::n,i,low,high
read *, low,high,n
print *,'low =',low
print *, 'high =', high
do i=low,high
a=mod(i,n)
if (a==0) then
print *, i
end if
end do
end program prob3
program test23
!print all numbers between LOW and HIGH that are divisible by NUMBER
integer::low,high,i,m,n
read*,low,high,n
do i=low,high
m=mod(i,n)
if(m==o)then
print*,i
end if
end do
end program test23