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.
Tutorialspoint

Excercise 20

program ex20
integer::a,b,c,d
read*,a,b
print *, 'a=',a
print *,'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

Excercise 19

program ex19
real::a,b
read*, a,b
print *, 'a=' ,a, 'b=',b
if (a>b) then
print*, 'max number =',a
end if 
print *, 'max number =',b
end program ex19

Excercie 18b

program ex18b
!mathematical operation
real:: x,y 
read*,x
if (x<3)then
y=6*x**2+1
print *, 'the value of y is=' ,y
else 
y=-5*x
print*, 'the value of y is=',y
end if 
end program ex18b

pro8

program pro8
!factorial of n
integer::i,n,f
read*,n
f=1
do i=1,n
f=f*i
end do
print*, f
end program pro8

prob8

program prob8
!factorial of the number n
integer :: i,n,f
read *,n
f=1
do i=1,n
f=f*i
end do
print *, f
end program prob8

problem 1

program prob21
! square of all numbers 1 to 10
integer::i,x
do i=1,10
x=i**2
print * ,x
end do
end program prob21

ex6

program ex6
!this program calcu;lates multiplication table for 6
integer::i,p
do i=1,12
p=i*6
print*,i,'x 6=',p
end do
end program ex6

program ex20

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 ex19

program ex19
real::a,b
read *, a,b 
print *,"a=", a ,"b =", b 
if (a>b)then 
print *, "max number =", a 
end if 
print *,"max number=", b 
end program ex19

prob5

program prob5
!  print all numbers from LOW to HIGH by steps of STEPS
integer ::i,low,high,step
read *,low,high,step
do i=low,high,step
print *,i
end do
end program prob5

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.