Integer or not?
Practice
3 (7 votes)
Input/output
Basics of input/output
String
Basic programming
Problem
44% Success 1585 Attempts 20 Points 5s Time Limit 256MB Memory 1024 KB Max Code

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

\(1\leq T \leq10\)

\(1\leq length(N) \leq10^5\)

Code snippets (also called starter code/boilerplate code)

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

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
16 votes
Tags:
ApprovedBasic ProgrammingEasyImplementationOpen
Points:10
185 votes
Tags:
Ad-HocApprovedBasic ProgrammingEasyImplementationOpen
Points:30
18 votes
Tags:
AlgorithmsApprovedBreadth First SearchGraphsMediumOpen