Showing posts with label Pseudocode and Flowcharts. Show all posts
Showing posts with label Pseudocode and Flowcharts. Show all posts

Sunday, October 13, 2019

Sum of Odd and Even Numbers Algorithms, Pseudocode and Flowcharts



Programming Problem

Write an algorithm and pseudocode, draw a flowchart that takes the number N, find the sum of odd and even numbers from 1 to N, and display the result on the screen.

Algorithm
                                                                                         
Step 1: Start                                                                                     
Step 2: Declare variables i, num, oddsum
             Declare variable evensum
Step 3: Input a value say num
Step 4: FOR i = 1 TO num
                 IF i % 2 = 0
       evensum = evensum + i
    ELSE
        oddsum = oddsum + i
       ENDIF
 DONE
Step 5: Display evensum
            Display oddsum
Step 6: Stop

Pseudocode

Start
    Declare Integer i, num, oddsum, evensum
    Assign oddsum = 0
    Assign evensum = 0
    Output "Sum of Odd and Even Numbers"
    Output "Give the value of num :"
    Input num
    For i = 1 to num
        If i % 2 = 0
            Assign evensum = evensum + i
        False:
            Assign oddsum = oddsum + i
        End
    End
    Output "Sum of all even numbers  = " & evensum &"."
    Output "Sum of all odd numbers  = " & oddsum &"."
End
Stop


Flowchart of Sum of Odd and Even Number


 I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.


My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking and Arduino Project development at a very affordable price.