Examples of step-form ( with solution )

Read about Step-form(Easy way)- Click here 

Examples

1.Write an algorithm to print a welcome message.

Solution - The desired algorithm to print the welcome message is given as follows: 

Steps:

  1. Start
  2. Print “Welcome to India”
  3. Stop 

2.Write an algorithm to print your name.

Solution - The desired algorithm to print your name is given as follows: 

Steps:

  1. Start
  2. Print “My name is Yash”
  3. Stop 

3.Write an algorithm to print any numeric value using the variable. (Use Assignment operator)

Solution - The desired algorithm to any numeric value using the variable is given as follows: 

Steps:

  1. Start
  2. input A
  3. A → 10
  4. Print A
  5. Stop 

4.Write an algorithm to find the sum of any two numbers. (Use Assignment operator)

Solution - The desired algorithm to find the sum of any two number is given as follows: 

Steps:

  1. Start
  2. input A, B, C
  3. A → 10
  4. → 05
  5. C ← A + B
  6. Print C
  7. Stop 

5.Write an algorithm to find the multiplication of any two numbers. Use Assignment operator)

Solution - The desired algorithm to find the multiplication of any two number is given as follows: 

Steps:

  1. Start
  2. input A, B, C
  3. A → 02
  4. → 05
  5. C ← A * B
  6. Print C
  7. Stop 

6.Construct an algorithm for interchanging the numeric values of two variables given by the user.

Solution - The desired algorithm for interchanging the numeric values of two variables given by the user is given as follows: 

Steps:

  1. Start
  2. print "Enter first number"
  3. input A
  4. print "Enter second number"
  5. input B
  6. T = A 
  7. A = B
  8. B = A
  9. C ← A * B
  10. Print A, B
  11. Stop 
7.Write an algorithm to print that the given number is positive or not.

Solution - The desired algorithm to find the given number is positive or not is given as follows: 

Steps:

  1. Start
  2. input A
  3. A → 5
  4. if
  5. (A > 0) then
  6. print "Given number is positive"
  7. else
  8. print "Given number is not positive"
  9. Stop 
8.Write an algorithm to check whether the student is pass or not. 

Solution - The desired algorithm to check whether the student is pass or not is given as follows: 

Steps:

  1. Start
  2. input SM
  3. SM → 50
  4. if
  5. (SM > 33 ) then
  6. print "Pass"
  7. else
  8. print "Fail"
  9. Stop 
Where, SM = students marks

9.Write an algorithm that compares two numbers and prints the message identifying the greater number.
or
Print largest number among two numbers.

Solution - The desired algorithm that compares two numbers and prints the message identifying the greater number is given as follows: 

Steps:

  1. Start
  2. input A, B
  3. → 20
  4. → 21
  5. if
  6. (A > B) then
  7. print "A is greater number"
  8. else
  9. print "B is greater number"
  10. Stop
10.Write an algorithm to check whether a number given by the user is odd or even. 

Solution - The desired algorithm to check whether a number given by the user is odd or even is given as follows: 

Steps:

  1. Start
  2. print "Enter first number"
  3. input A
  4. if
  5. (A%2=0 ) then
  6. print "Number is even"
  7. else
  8. print "NUmber is odd"
  9. Stop
11.Print largest number among three numbers. (use logical operator)

Solution - The desired algorithm to print largest number among three numbers. (use logical operator) is given as follows: 

Steps:

  1. Start
  2. input A, B, C
  3. → 50
  4. → 54
  5. → 23
  6. if
  7. (A > B AND A > C)
  8. print "A is largest number"
  9. else if (B > A AND B > C)
  10. print "B is largest number"
  11. else
  12. print "C is largest number"
  13. Stop 
12.Write an algorithm for the addition of N-given numbers.

Solution - The desired algorithm to find the addition of N-given numbers is given as follows: 

Steps:

  1. Start
  2. input C
  3. while C < = 40
  4. Begin
  5. Print C
  6. C ← C + 1
  7. End
  8. Stop 

Post a Comment

0 Comments