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

prob4

program prob4
!10 nmbrs frm the user and print their sum and product
integer :: i,s,p,a
s=0
p=1
do i=1,10
read *, a
s=s+a
p=p*a
end do
print *, 'sum s=' ,s
print *, 'product p=' ,p
end program prob4

pro4

program ex4
!this prgm print sum and product
integer::i,s,p,a
s=0
p=1
do i=1,10
read*,a
s=s+a
p=p*a
end do
print*, 's=',s
print*,'p=' ,p
end program ex4

prob3

program prob3
!this program calc all number between low and high that are divisible by number
integer::i,s,n,low,high
read*,low,high,n
do i=low,high
s=mod(i,n)
if(s==0)then
print*,i
end if 
end do
end program prob3

prob3

program prob3
! print all number between LOW and HIGH that are divisible by NUMBER
integer :: i,low,high,n,s
read *, low,high,n
do i=low,high
s=mod(i,n)
if(s==0) then
print *, i
end if 
end do
end program prob3

ex2

program ex2
!this program calculates sum of numbers from low to high
integer::i,s,low,high
read *, low,high
s=0
do i=low,high
s=s+i
end do 
print*,'low number is', low
print*,'high number is', high
print*,'sum from low to high',s
end program ex2

ex1

program ex1
!this program calculates square of all numbers from 1 to 10
integer::i,p
p=1
do i=1,10
p=i**2
print *,p
end do
end program ex1

ex25

program ex25
!cal values of the fun y=4x-6
integer :: i,y,x
do i=0,20,2
y=4*i-6
print *, y
end do
end program ex25

ex25

program ex25
!this program calc values of function y=4x-6
integer::i,y,x
do i=0,20,2
y=4*i-6
print*,y
end do 
end program ex25

ex24

program ex24
! calculate sum of squares of first five natural numbers
integer :: i,s
s=0
do i=1,5
s=s+i**2
end do
print *, s
end program ex24

ex24

program ex24
!sum of the squares of first five natural numbers
integer ::i,s
s=0
do i=1,5
s=s+i**2
end do
print *, s
end program ex24

Advertisements
Loading...

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