Wednesday, August 28, 2013

TOPIC 2: LOGIC BUILDING USING PSEUDO CODE

2.1 Flowchart and Pseudo Code

Assignment 2.1.1: Problem Solving through flowchart

Problem Description: Draw a flowchart for the following problems:

1. Add first N even numbers

SOLUTION : 


flowchart to show addition of first 'n' even numbers


2.   Add first n odd numbers

SOLUTION :


Flowchart showing addition of first 'n' odd numbers


3.  Find maximum of three numbers

SOLUTION :


Flowchart showing maximum of three numbers


4. Determine whether a year s leap year or not

SOLUTION :


Flowchart showing whether a year is leap year or not

5. Input a number and check whether it is prime or not

SOLUTION :


Flowchart showing whether a number is prime or not


6. Input a number and check whether it can be expressed as some positive integer power of 2. For example 2,4,8,16,32… etc. can expressed as some positive integer power of 2 like 2^1,2^2,2^3,2^4, and 2^5……..

SOLUTION : 


Flowchart expressing a number as power of 2

No comments:

Post a Comment