Logo 
Search:

Cobol Articles

Submit Article
Home » Articles » Cobol » Homework HelpRSS Feeds

PROGRAM TO FIND THE SUM OF THE SERIES 1 + 1/4 + 1/9

Posted By: Vinicius Costa     Category: Cobol     Views: 4941

PROGRAM TO FIND THE SUM OF THE SERIES 1 + 1/4 + 1/9 ...

Code for PROGRAM TO FIND THE SUM OF THE SERIES 1 + 1/4 + 1/9 in Cobol

       Identification Division.
       Program-Id. Sum-Series-6.

       Environment Division.

       Data Division.
       Working-Storage Section.
       77 N       Pic 999.
       77 Counter Pic 999.
       77 Tempsum Pic 99v9999 Value 0.

      * The Designing of the Main Screen of the Program.
      
       Screen Section.

      * The Input Screen.

       01 Main-Screen.
          02 Line 3 Column 25 " The Series to be Calculated is : "
             Reverse-Video Blink.
          02 Line 5 Column 28 "1 + 1/4 + 1/9 + 1/16 ..." Highlight.
          02 Line 7 Column 15 "Enter the No. of terms for the above seri
      -      "es : ".
          02 Line 7 Column 60 Pic 999 To N Highlight.

      * The Output Screen.

       01 Display-Screen.
          02 Line 10 Column 10 "The Sum of the above Series for     term
           "s is : ".
          02 Line 10 Column 42 Pic zz9 From N Highlight.
          02 Line 10 Column 58 Pic zz.9999 From Tempsum Highlight.

       Procedure Division.

      * The Initialize-Para.

       Main-Para.
           Display Main-Screen.
           Accept Main-Screen.
           Perform Series-Loop Varying Counter From 1 By 1 Until
                   ( Counter > N).
           Display Display-Screen.
           Stop Run.

      * The Paragraph to Calculate the Sum.

       Series-Loop.
           Compute Tempsum = Tempsum + (1 / (Counter * Counter) ).

  
Share: 


Didn't find what you were looking for? Find more on PROGRAM TO FIND THE SUM OF THE SERIES 1 + 1/4 + 1/9 Or get search suggestion and latest updates.

Vinicius Costa
Vinicius Costa author of PROGRAM TO FIND THE SUM OF THE SERIES 1 + 1/4 + 1/9 is from Salvador, Brazil.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!