Collectiva Contest Programs & Solutions

Unity Number
Write a function to return if the given number is an Unity number. 
Return 1 if the given number is an Unity number, return 0 if it is not an unity number. 

An unity number is one which when sum up its individual digits repeatedly, until it is becoming a single digit number, becomes 1. 

Example 1: 12345 when added (1+2+3+4+5) comes to 15, 15 when added (1+5) comes to 6. Hence the final single digit number is 6, so it is not a unity number. 

Example 2: 72361 when added (7+2+3+6+1) comes to 19, 19 when added (1+9) comes to 10, 10 when added (1+0) comes to 1. 

This is an Unity Number.

No Comments..!

Change Subject: