**Floor climbing 1 problem solution lpu question: **

Supriya and Namita live at a hotel. The hotel is divided into 10 storeys, each of which has 10 rooms. Rooms numbered 1 through 10 are located on floor 1. Rooms 11 through 20 are located on floor 2. Rooms 10 (i-1) + 1 to 10i are located on floor i.

You are aware that the room numbers for Supriya and Namita are X and Y, respectively. Determine how many levels Supriya must climb/descend if she begins in her room to get to Namita’s room.

**Input Format**

T, the number of test cases, will be in the first line. The test cases come next. Each test case consists of a single line of input with two integers, X and Y, which correspond to the rooms that Supriya and Namita are located in.

Sample Input:

4

1 100

42 50

53 30

81 80

**Constraints**

1 ≤ T ≤ 1000

1 ≤ X, Y ≤ 100

X ≠ Y

**Output Format**

Output the number of floors Supriya must climb to get to Namita’s room for each test scenario.

Sample Output:

9

0

3

1

**Sample Input 0**

4

1 100

42 50

53 30

81 80

**Sample Output 0**

9 0 3 1

# Solution

Include

Include

Include

int main() {

/* Enter your code here. Read input from STDIN. Print output to STDOUT */

return 0;

}

– – – – – – – – – – – – – – – – – – – – – –

#include <iostream>

using namespace std;

struct Node

{

int data;

Node *next;

};

Node *top=NULL;

void push(int item)

{

Node *newNode=new Node;

newNode->data=item;

newNode->next=top;

top=newNode;

}

void pop()

{

if(top==NULL)

cout<<“Underflow”<<endl;

else

{

cout<<“Element removed from top is “<<top->data<<endl;

top=top->next;

}

}

void Top()

{

if(top==NULL)

cout<<“Stack is Empty”<<endl;

else

cout<<top->data<<endl;

}

int main()

{

Top();

pop();

push(25);

push(37);

push(88);

push(34);

push(80);

Top();

pop();

Top();

push(2);

Top();

return 0;

}

Related articles

Howtofixgadgets.com: Floor climbing 1 problem solution lpu question