Categories
C# / .NET Program

C# program to group the sequence of number

This program will group the sequence of a number from the list with (-), for this example input 1,2,3,4  the output will be 1-4. If there is no sequence of the number then it should be printed as it is, example: 1,3,10 will provide the following output 1,3,10. Program Output: Enter the number: 1,2,3,4,10,11,12,20,100 1-4,10-12,20,100

Categories
Program Ruby

Ruby program for Happy and Unhappy(sad) Numbers

Description As per Wiki,  Happy Number – A happy number is a number defined by the following process: Starting with any positive integer, replace thenumber by the sum of the squares of its digits, and repeat the process until the number either equals 1 (where it will stay), or it loops endlessly in a cycle that does not include 1, 7, 10, 13, […]

Categories
C# / .NET Program

C# Program to find Happy and Sad Number

Description As per Wiki,  Happy Number – A happy number is a number defined by the following process: Starting with any positive integer, replace thenumber by the sum of the squares of its digits, and repeat the process until the number either equals 1 (where it will stay), or it loops endlessly in a cycle that does not include 1, 7, 10, 13, […]