Math, asked by shaziyamemon13, 9 months ago

Big Bunny lives in a colony. He is the only bunny in his colony who is not able to hop. On his 5th birthday, his father bunny gifted him a pogo stick as he could not jump like the other bunnies. He is so excited to play with the pogo stick. The pogo stick hops one unit per jump. He wanders around his house jumping with pogo sticks. He wants to show the pogo stick to his friends and decides to go using pogo sticks. Write a program to find the number of hops needed to reach his friends' house. Assume that Big Bunny's house is in the location (3,4).

Answers

Answered by mad210219
14

Given:

Big Bunny lives in a colony. He is the only bunny in his colony who is not able to hop. On his 5th birthday, his father bunny gifted him a pogo stick as he could not jump like the other bunnies. He is so excited to play with the pogo stick. The pogo stick hops one unit per jump. He wanders around his house jumping with pogo sticks. He wants to show the pogo stick to his friends and decides to go using pogo sticks.

To prove:

Write a program to find the number of hops needed to reach his friends' house. Assume that Big Bunny's house is in the location (3,4).

Solution :

We will make out the program using C++ programming language.  

In C++,  

iostream.h header file is used for input and output.  

The commands are cout and cin.  

math.h for operating all the mathematics operations.  

The command used is sqrt.  

So, the program will be as follows:

#include<iostream>

#include<math.h>

using namespace std;

int main()

{

int x,y,l,m,j,r,z,f;

int a=3,b=4;

cin>>x;

cin>>y;

l=(x-a);

m=(y-b);

j=l*l;

r=m*m;

z=j+r;

f=sqrt(z);

cout<<f;  

}

Hence, we have developed a program so that bunny can reach his friend's house.  

Answered by manoj2425
10

#include<iostream>

#include<math.h>

using namespace std;

int main()

{

int x,y,l,m,j,r,z,f;

int a=3,b=4;

cin>>x;//5

cin>>y;//10

l=(x-a);//2

m=(y-b);//6

j=l*l;//4

r=m*m;//36

z=j+r;//40

f=sqrt(z);//6

cout<<f;

}

Similar questions