0% found this document useful (0 votes)
91 views

Assignment 1 - Problem Solving PDF

The document contains 10 problems involving writing pseudocode to solve various problems: 1) Print a nested number pattern for a given N 2) Print the reverse of a given number 3) Print the Nth Fibonacci number 4) Find the best position to stand in a line where odd positions are removed to be selected for a ship crew 5) Given coordinates (x,y), find the number written at that point based on a pattern of writing non-negative integers 6) Print a nested asterisk pattern for a given N 7) Print a diagonal asterisk pattern for a given N 8) Print all Fibonacci numbers less than a given N 9) Print all prime numbers from 2 to

Uploaded by

MRINAAL GOSAIN
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
91 views

Assignment 1 - Problem Solving PDF

The document contains 10 problems involving writing pseudocode to solve various problems: 1) Print a nested number pattern for a given N 2) Print the reverse of a given number 3) Print the Nth Fibonacci number 4) Find the best position to stand in a line where odd positions are removed to be selected for a ship crew 5) Given coordinates (x,y), find the number written at that point based on a pattern of writing non-negative integers 6) Print a nested asterisk pattern for a given N 7) Print a diagonal asterisk pattern for a given N 8) Print all Fibonacci numbers less than a given N 9) Print all prime numbers from 2 to

Uploaded by

MRINAAL GOSAIN
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

1

Assignment 1 – Problem Solving


1. Write pseudocode to print the following pattern for given N = 4
1

2 3 2

3 4 5 4 3

4 5 6 7 6 5 4

2. Write pseudocode to print reverse of a number


3. Write pseudocode to print Nth Fibonacci, where 0 is 0th and 1 is 1st Fibonacci
number
4. The captain of the ship TITANIC is a little off the track. He needs to select the
crew for the ship. But everyone seems to be eligible. So to test their intelligence,
he plays a game. The contestants have to stand in a line. They are given the
numbers in the order in which they stand, starting from 1. The captain then
removes all the contestants that are standing at an odd position.

Initially, standing people have numbers - 1,2,3,4,5...


After first pass, people left are - 2,4,...
After second pass - 4,...
And so on.

You want to board the ship as a crew member. Given the total number of
applicants for a position, find the best place to stand in the line so that you are
selected.
5. Starting from point (0,0) on a plane, we have written all non-negative integers 0,
1, 2.. as shown in the figure. For example, 1, 2, and 3 has been written at points
(1,1), (2,0), and (3, 1) respectively and this pattern has continued.
2
Assignment 1 – Problem Solving
You are to find out the coordinates of a point (x, y), and writes the number (if
any) that has been written at that point. (x, y) coordinates in the input are in the
range 0 to100000.
6. Take N (number of rows), write pseudo-code to print the following pattern (for N
= 5)
*

* * *

* * * * *

* * *

7. Take N (number of rows), write pseudo-code to print the following pattern (for N
= 5)

* * * * * *

* * * *

* *

* * * *

* * * * * *

8. Take N as input. Write pseudo-code to print all Fibonacci numbers less than N.
9. Take N as input. Write pseudo-code to print all prime numbers from 2 to N.
10. Write the pseudo-code to calculate GCD of two numbers.

You might also like