Saturday, November 24, 2012

sum of square of a series using do statement


** Find sum of the following series




  1234567890
                 Write(*,*) 'Enter the value of N'
                 Read(*,*) N
                 Sum=0.0
                 Do j=1,N
                Sum=sum+j**2
                 End do
                 Write(*,*) 'The result of the series' ,sum
                 End
  Just copy and paste this problem on your Force 2.0 and run and put the values up to N and you will get the result.
** Find the sum of series 
 

 
1234567890
                Write(*,*) 'Enter the value of N'
                 Read(*,*) N
                 Sum =0.0
                 Do k =1,N
                Write(*,*) 'Enter the value of x',k
                 Read(*,*) x
                 Sum = sum +x**2
                  End do
                 Write(*,*) 'The result of the series ' , sum
                  End
  Just copy and paste this problem on your Force 2.0 and run and put the values up to x’s and you will get the result .
               




No comments:

Post a Comment