Naina Function
Practice
3.2 (4 votes)
Easy
Problem
84% Success 1397 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Arun has a keen interest in maths and recently he came to know about weird function known as Naina function. Arun gave you a number "N" and asked you to evaluate Naina's function. The definition of Naina function is

F ( X ) = X , X <= 9
         = F ( sum of digits in X )
where, X = N3

Input:
First line of input contains T - Total no. of test cases
Each test case contains the number "N".

Output:
For each testcase, print the value of Naina function.

Constraints
1<=T<=100
1<= Number of digits in N <= 104

Problem Setter : Satyam Swarnkar

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:30
31 votes
Tags:
Ad-HocApprovedData StructuresMediumOpen
Points:20
Tags:
Ad-HocEasy