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
2
A program to find the number of hops needed to reach his friends' house is as follows.
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int p1=3,q=4,p1,q1;
double pow,pow1,pow2,sqr;
std::cin>>p1>>q1;
pow1=pow((p1-p),2);
pow2=pow((q1-q),2);
pow=pow1+pow2;
sqr=sqrt(pow);
std::cout<<int(sqr);
return 0;
}
Answered by
2
Answer:
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int x,y;
cin>>x>>y;
int result;
result = sqrt( (x-3)*(x-3) + (y-4)*(y-4) );
cout<<result;
}
Step-by-step explanation:
Similar questions
Science,
4 months ago
Social Sciences,
4 months ago
Social Sciences,
4 months ago
Math,
9 months ago
Science,
9 months ago
Math,
1 year ago
Science,
1 year ago