You are on page 1of 2

Program kvadar

! Program raèuna zapreminu dva kvadrata i raèuna povrsinu i dijagonalu manjeg
real::a2,b2,c2,V2,a1,b1,c1,V1,P1,d1,p2,d2
print*,'unesi prvu vrijednosti kvadra a1,b1,c1 '
read*,a1,b1,c1
print*,'unesi drugu vrijednosti kvadra a2,b2,c2 '
read*,a2,b2,c2
V1=a1*b1*c1
V2=a2*b2*c2
print*, 'Zapremine su V1=',V1,'V2=',V2
IF(V1.GT.V2) then
P2=2*((a2*b2)+(a2*c2)+(b2*c2))
print*, 'Povrsina manjeg kvadra je P2=',P2
d2= sqrt((a2**2)+(b2**2)+(c2**2))
print*, 'dijagonala manjeg kvadra je d2=',d2
end if
IF(V2.GT.V1) then
P1=2*((a1*b1)+(a1*c1)+(b1*c1))
print*, 'Povrsina manjeg kvadra je P1=',P1
d1=sqrt((a1**2)+(b1**2)+(c1**2))
print*, 'dijagonala manjeg kvadra je d1=',d1
end if
end program
________________________________________________________________________________
____________________________________________
Program niz
! Progam koji raèuna 10 elemenata niza A tako sto na parnim mjestima sabira a na n
eparnim mno i
dimension A(5)
print*,'Unesi 5 elemente niza'
do 1 i=1,5
read*,A(i)
1 continue
S=0
P=1
do 2 i=1,5
s=s+A(i)*2
p=p*(A(i)*2-1)
2 continue
print*,'proizvod je P=',p,'Suma je S=',s
if(s.gt.p)then
print*,'Proizvod je manji P=',p
else
print*,'Suma je manja S=',s
end if
pause
end
________________________________________________________________________________
____________________________________________
________________________________________________________________________________
____________________________________________
________________________________________________________________________________
____________________________________________
________________________________________________________________________________
____________________________________________

________________________________________________________________________________ ____________________________________________ ________________________________________________________________________________ ____________________________________________ .