QUESTION DESCRIPTION :
The shape of the college ground is Square. For the Independence day Flag Hoisting Function, it has been decided to place the flag post at the exact center of the ground. Can you please help them in placing the flag post at the exact center?
TEST CASE 1
INPUT
4 0 8
OUTPUT
centre of the ground is at(8,4)
EXPLANATION :
This question requires you to find the center of the square whose left bottom coordinates ( x,y ) and length is given. To find the coordinates we use basic geometry.
FORMULA :
Center X : x + l/2 , Center Y : y +l/2
ALGORITHM :
SOLUTION : (Please use this as reference only)
The shape of the college ground is Square. For the Independence day Flag Hoisting Function, it has been decided to place the flag post at the exact center of the ground. Can you please help them in placing the flag post at the exact center?
Given the coordinates of the left bottom vertex of the square ground and
the length of the side, you need to write a program to determine the
coordinates of the centre of the ground.
[Assumption --- Length of the side is always even]
Input Format:
Input consists of 3 integers. The first integer corresponds to the x-coordinate of the left bottom vertex. The second integer corresponds to the y-coordinate of the left bottom vertex. The third integer corresponds to the length of the square.
[Assumption --- Length of the side is always even]
Input Format:
Input consists of 3 integers. The first integer corresponds to the x-coordinate of the left bottom vertex. The second integer corresponds to the y-coordinate of the left bottom vertex. The third integer corresponds to the length of the square.
INPUT
4 0 8
OUTPUT
centre of the ground is at(8,4)
EXPLANATION :
This question requires you to find the center of the square whose left bottom coordinates ( x,y ) and length is given. To find the coordinates we use basic geometry.
FORMULA :
Center X : x + l/2 , Center Y : y +l/2
ALGORITHM :
- Input the lower bottom x and y coordinates ( x,y )
- Input the length of square side ( l )
- Calculate the coordinates using the formula and print it with appropriate message ( print as int %d , "center" as used by me is from American English )
SOLUTION : (Please use this as reference only)
CODE |
No comments:
Post a Comment