Beruflich Dokumente
Kultur Dokumente
END WHILE
Exercise 2
Pseudocode:
Count = 1
What is output of above program
WHILE (Count < 5)
OUTPUT “ * ” ****
Count= Count +1
END WHILE
Exercise 3
Pseudocode:
Count = 1
OUTPUT “ * ”
Count= Count +1
END WHILE
Exercise 4
Pseudocode:
Count = 1
Z=1
Count= Count +1
END WHILE
OUTPUT Z
Exercise 6
Pseudocode:
Sum = 0
Count = 1
OUTPUT Sum
Exercise 7
Pseudocode:
Count = 1
Pseudocode:
END WHILE
Exercise9
Pseudocode:
Count = 1
What is output of above program
OUTPUT “ * ”
Count= Count +1
If (Count == 4)
OUTPUT “ New line”
Count = 1
END IF
END WHILE
Write Code:
• To calculate Factorial of any number.
• To calculate the power of any given number.
• To Print Table of Any Number up till 10:
Exercise 11
Print Table of Any Number
1. Set Number1 = 1 Exercise 12
2. Set Number2 = 2
3. Set Number3 = 3
4. Set value of Sum = Number1+Number2+Number3
5. while (sum <= 39)
6. begin while loop
Number1 = Number2
Number2 = Number3
Number3 = Sum
Sum = Number1+Number2+Number3
output “*”
7. end of while loop
8. output “Number1 is :”, output Number1
9. output “Number2 is:”, output Number2
10. output “Number3 is:”, output Number3
11. output “Sum is:”, output Sum
START
Exercise 13
Number1 = 1
Number2 = 30
Sum = 0
while (Number2 >= Number1)
begin while loop
Number1 = Number1 + 1
Number2 = Number2 – 2
Sum = Number1 + Number2
end while loop
output “Number1 is :”, output Number1
output “Number2 is:”, output Number2
output “Sum is”, output Sum
END
Problems
1. Write pseudocode for a program which reads 10 integers from the user,
stopping only when the user, and output the largest value input.
2. A student buys various books at the start of the semester from a bookshop.
Write pseudocode for a program which takes the total amount spent on
books and the total number of books as input and outputs the average cost
per book.
3. Write pseudocode for a program that prints the numbers from 1 to 100. But
for multiples of three print “Fizz” instead of the number and for the multiples
of five print “Buzz”. For numbers which are multiples of both three and five
print “FizzBuzz”.