pseudo code is the methodology that allows to programmer to represent the implementation of an algorithm simply we can say that it's the cooked up representation of an algorithm
Advantages of an pseudocode :
1) Improves the readability of any approach
2) acts as a bridge between the programmer and the algorithm or flowchart
3) main goal of pseudocode is to explain that what should the each line of code wants to execute
pseudocode vs Algorithm :
Algorithm :
1) it is the sequence of well define steps
2) it is systematic and logical approach
3) these is written by using plain text that's why easy to debug but difficult to understand
4) it can be represented by using natural language or the flowchart
5) there are no rule to create the algorithms
Pseudo code :
1) it is one of the important method to implement the algorithm
2) it is the simpler version of coding that means easy to understand
3) it is written in plain English and uses short phrases to write the functionalities that specific line of code would do
4) control structures like 'while' , 'if-then-else' , 'repeat-until' and many more can be used
5) there are many formats that could be used to writ5e pseudo-codes
Que 1) Write a pseudocode to check the number is even or odd
Method 01
1. start
2. print "enter any number to check, even or odd"
3. read input of a number
4. if number mod = 0
5. print "number is even"
6. else print "number is odd"
7. stop
Method 02
1. start
2. print "enter any number to check, even or odd"
3. read input of a number
4. if number mod = 1
5. print "number is odd"
6. else print "number is even"
7. stop
Que 2) Write a pseudocode to find out the fibonacci series
1. start
2. declare variable a, b, c, n, i
3. initialize variable a=0, b=1 and i=2
4. read n from user
5. print a and b
6. repeat until i <= n
c=a+b
print c
a=b, b=c
i=i+1
7. stop
Que 3) Write the pseudo code to find out the factorial of given number
1. Start
2. declare N and F as integer variable
3. initialize F=1
4. Enter the value of N
5. check whether N>0 f not then F=1
6. if yes then, F=F*N
7. decreases the value of N by 1
8. repeat step 4 and 5 until N=0
9. now print value of F
10. Stop
0 Comments