42 7 Program P2 Real X Y Integer KS Read Xn Do K 1 N Y Y K X k s S S Enddo

# 42 7 program p2 real x y integer ks read xn do k 1 n

• 18

This preview shows page 11 - 16 out of 18 pages.

) + (4/2 7 ) Program P2 Real :: X, Y Integer :: K,S Read *,X,n Do K = 1 ,N Y = Y + K / X k * s S = - S Enddo Print *, Y End

Subscribe to view the full document.

12 7 ﻥﺍﺭﺗﺭﻭﻓ ﺔﺟﻣﺭﺑﻟﺍ ﺔﻐﻠﺑ ﺞﻣﺎﻧﺭﺑ ﺏﺗﻛﺍ ( 90 : ﺔﻳﻟﺎﺗﻟﺍ ﻡﺎﻬﻣﻟﺍ ءﺍﺩﻻ ﺓءﺍﺭﻗ 10 . ﺔﻔﻠﺗﺧﻣ ﺩﺍﺩﻋﺍ . ﺔﺑﻟﺎﺳﻟﺍ ﻡﺎﻗﺭﻻﺍ ﻉﻭﻣﺟﻣ ﺩﺎﺟﻳﺍ : ﺞﻣﺎﻧﺭﺑﻟﺍ = ﺩﺩﻌﻟﺍ ﻥﺍ ﺽﺭﻔﻧ NUM = ﺔﺑﻟﺎﺳﻟﺍ ﺩﺍﺩﻋﻻﺍ ﻉﻭﻣﺟﻣ Nsum = ﺭﺍﺭﻛﺗﻟﺍ ﺩﺍﺩﻋ K Program P1 Real :: Num , Nsum Integer :: K Nsum = 0 Do k = 1 , 10 Read *,Num IF ( Num < 0 ) Then Nsum = Nsum + Num ENDIF Enddo Print *," Nsum = ",Nsum End
13 8 ﻥﺍﺭﺗﺭﻭﻓ ﺔﺟﻣﺭﺑﻟﺍ ﺔﻐﻠﺑ ﺞﻣﺎﻧﺭﺑ ﺏﺗﻛﺍ ( 90 : ﺔﻳﻟﺎﺗﻟﺍ ﻡﺎﻬﻣﻟﺍ ءﺍﺩﻻ ﺓءﺍﺭﻗ 10 . ﺔﻔﻠﺗﺧﻣ ﺩﺍﺩﻋﺍ . ﺔﺑﻟﺎﺳﻟﺍ ﺩﺍﺩﻋﻻﺍ ﻝﺩﻌﻣ ﺩﺎﺟﻳﺍ : ﺞﻣﺎﻧﺭﺑﻟﺍ = ﺩﺩﻌﻟﺍ ﻥﺍ ﺽﺭﻔﻧ NUM = ﺔﺑﻟﺎﺳﻟﺍ ﺩﺍﺩﻋﻻﺍ ﻉﻭﻣﺟﻣ Nsum = ﺭﺍﺭﻛﺗﻟﺍ ﺩﺍﺩﻋ K = ﺔﺑﻟﺎﺳﻟﺍ ﻡﺎﻗﺭﻻﺍ ﺩﺍﺩﻋ Ncnt = ﻝﺩﻌﻣﻟﺍ Nsum / Ncnt Program P1 Real :: Num , Nsum Integer :: K , Ncnt Nsum = 0 Ncnt = 0 Do k = 1 , 10 Read *,Num IF ( Num < 0 ) Then Nsum = Nsum + Num Ncnt = Ncnt + 1 ENDIF Enddo Print *," Naverage = ", Nsum / Ncnt End

Subscribe to view the full document.

14 9 ﻥﺍﺭﺗﺭﻭﻓ ﺔﺟﻣﺭﺑﻟﺍ ﺔﻐﻠﺑ ﺞﻣﺎﻧﺭﺑ ﺏﺗﻛﺍ ( 90 : ﺔﻳﻟﺎﺗﻟﺍ ﻡﺎﻬﻣﻟﺍ ءﺍﺩﻻ ﺓءﺍﺭﻗ 10 . ﺔﻔﻠﺗﺧﻣ ﺩﺍﺩﻋﺍ . ﺔﺑﻟﺎﺳﻟﺍ ﺩﺍﺩﻋﻻﺍ ﻝﺩﻌﻣ ﺩﺎﺟﻳﺍ . ﺔﺑﺟﻭﻣﻟﺍ ﺩﺍﺩﻋﻻﺍ ﻝﺩﻌﻣ ﺩﺎﺟﻳﺍ : ﺞﻣﺎﻧﺭﺑﻟﺍ = ﺩﺩﻌﻟﺍ ﻥﺍ ﺽﺭﻔﻧ NUM = ﺔﺑﻟﺎﺳﻟﺍ ﺩﺍﺩﻋﻻﺍ ﻉﻭﻣﺟﻣ Nsum = ﺔﺑﺟﻭﻣﻟﺍ ﺩﺍﺩﻋﻻﺍ ﻉﻭﻣﺟﻣ Psum = ﺭﺍﺭﻛﺗﻟﺍ ﺩﺍﺩﻋ K = ﺔﺑﻟﺎﺳﻟﺍ ﺩﺍﺩﻋﻻﺍ ﺩﺍﺩﻋ Ncnt = ﺔﺑﺟﻭﻣﻟﺍ ﺩﺍﺩﻋﻻﺍ ﺩﺍﺩﻋ Pcnt = ﺔﺑﻟﺎﺳﻟﺍ ﺩﺍﺩﻋﻻﺍ ﻝﺩﻌﻣ Nsum / Ncnt = ﺔﺑﺟﻭﻣﻟﺍ ﺩﺍﺩﻋﻻﺍ ﻝﺩﻌﻣ Psum / Pcnt Program P1 Real :: Num , Nsum Integer :: K , Ncnt Nsum = 0 Ncnt = 0 Do k = 1 , 10 Read *,Num IF ( Num < 0 ) Then Nsum = Nsum + Num Ncnt = Ncnt + 1 Else Psum = psum + Num Pcnt = pcnt + 1 ENDIF Enddo Print *," Naverage = ", Nsum / Ncnt , "Paverage ", Psum / Pcnt End