# Floor, Ceil and Rint in Python HackerRank Solution

#### ByBrokenprogrammers

Dec 10, 2022

Hello Programmers, In this post, you will know how to solve the Floor, Ceil and Rint in Python HackerRank Solution. This problem is a part of the HackerRank Python Programming Series.

One more thing to add, donâ€™t directly look for the solutions, first try to solve the problems of Hackerrank by yourself. If you find any difficulty after trying several times, then you can look for solutions.

## Floor, Ceil and Rint in Python HackerRank Solution

### Problem

floorThe tool floor returns the floor of the input element-wise.
The floor of x is the largest integer i where i <= x.

```import numpy
my_array = numpy.array([1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9])
print numpy.floor(my_array)         #[ 1.  2.  3.  4.  5.  6.  7.  8.  9.]
```

ceilThe tool ceil returns the ceiling of the input element-wise.
The ceiling x of is the smallest integer i where i >= x.

```import numpy
my_array = numpy.array([1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9])
print numpy.ceil(my_array)          #[  2.   3.   4.   5.   6.   7.   8.   9.  10.]
```

rintThe rint tool rounds to the nearest integer of input element-wise.

```import numpy
my_array = numpy.array([1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9])
print numpy.rint(my_array)          #[  1.   2.   3.   4.   6.   7.   8.   9.  10.]
```

You are given a 1-D array, A. Your task is to print the floor, celi and rint of all the elements of A.

#### Input Format :

A single line of input containing the space separated elements of array A.

#### Output Format :

On the first line, print the Floor of A.
On the second line, print the Ceil of A.On the third line, print the Rint of A.

#### Sample Input :

```1.1 2.2 3.3 4.4 5.5 6.6 7.7 8.8 9.9
```

#### Sample Output :

```[ 1.  2.  3.  4.  5.  6.  7.  8.  9.]
[  2.   3.   4.   5.   6.   7.   8.   9.  10.]
[  1.   2.   3.   4.   6.   7.   8.   9.  10.]
```

### Floor, Ceil and Rint in Python HackerRank Solution

```import numpy
numpy.set_printoptions(sign=' ')
array = numpy.array(input().split(),float)
print(numpy.floor(array))
print(numpy.ceil(array))
print(numpy.rint(array))```

Disclaimer: The above Problem (Floor, Ceil and Rint in Python) is generated by Hackerrank but the Solution is Provided by BrokenProgrammers. This tutorial is only for Educational and Learning purposes.