Computer Science, asked by thasneeemfathima2017, 11 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 jobastin
18

Answer:

#include <iostream>

#include <bits/stdc++.h>  

using namespace std;  

int main()

{  

int x1=3,y1=4,x2,y2;

double power,power1,power2,sqr;

std::cin>>x2>>y2;

power1=pow((x2-x1),2);

power2=pow((y2-y1),2);

power=power1+power2;

sqr=sqrt(power);

std::cout<<int(sqr);

return 0;

}

Explanation:

Answered by Anonymous
10

The program  to find the number of hops needed to reach Bunny's friends' house is as follows:

#include <iostream>

#include <bits/stdc++.h>  

using namespace std;  

int main()

{  

int a1=3,b1=4,a2,b2;      //initialization of variables

dou,pwr1,pwr2,sqaure;

std::cin>>a2>>b2;

pwr1=pow((a2-a1),2);       //logic

pwr2=pow((b2-b1),2);      //logic

pwr=pwr1+pwr2;

square=sqrt(pwr);

std::cout<<int(square);

return 0;

}

  • The above program is written in C++ programming language.
Similar questions