C Program to find the volume and surface area of a cuboid
write(*,*)'Enter the length:'
read(*,*)r
write(*,*)'Enter the width:'
read(*,*)w
write(*,*)'Enter the height:'
read(*,*)h
a=2.0*(w*r+r*h+h*w)
v=w*r*h
d=sqrt(w**2+r**2+h**2)
write(*,10)a
write(*,20)v
write(*,30)d
10 format(2x,'The area of the cuboid is',f16.4)
20 format(2x,'The volume of the cuboid is',f16.4)
30 format(2x,'The space diagonal of the cuboid is',f16.4)
end
write(*,*)'Enter the length:'
read(*,*)r
write(*,*)'Enter the width:'
read(*,*)w
write(*,*)'Enter the height:'
read(*,*)h
a=2.0*(w*r+r*h+h*w)
v=w*r*h
d=sqrt(w**2+r**2+h**2)
write(*,10)a
write(*,20)v
write(*,30)d
10 format(2x,'The area of the cuboid is',f16.4)
20 format(2x,'The volume of the cuboid is',f16.4)
30 format(2x,'The space diagonal of the cuboid is',f16.4)
end
Comments
Post a Comment