Integer or not?

3

7 votes
Input/Output, Basics of Input/Output, String, Basic Programming
Problem

You are given a decimal number N.

Task

Print YES if the given number can be represented in the form of an integer, else print NO.

Example

Assumption

  • N = 35.8

Approach

As 35.8 can not be accurately represented as an integer as 35 is not equal to 35.8, the answer is NO.

Function description

Complete the function solve provided in the editor. This function takes the following parameter and returns the required answer:

  • N: Represents a decimal number

Input format

Note: This is the input format that you must use to provide custom input (available above the Compile and Test button).

  • The first line contains a single integer T which denotes the number of test cases. T also denotes the number of times you have to run the solve function on a different set of inputs.
  • For each test case:
    • The first line contains a string denoting the decimal number.

Output format

For each test case, print YES if the given number can be represented in the form of integer, else print NO.

Constraints

1T10

1length(N)105

Code snippets (also called starter code/boilerplate code)

This question has code snippets for C, CPP, Java, and Python.

Time Limit: 5
Memory Limit: 256
Source Limit:
Explanation

34.0 can be represented as integer while 34.9 can not

Editor Image

?