Untitled

                Never    
Java
       
import java.util.Scanner;

public class main8 {
    public static void main(String[] args) {
//4.17
        int num = 10;
        int counter = 0;
        int temp=0;
//      to loops to check if happy
//will run until 3 cosecetive happy nums
        while (counter != 3){
// resul get the value of the num after first check via function
        int res = checkNum(num);
// the check starts fron the num 10        
            while (res > 9) {
//now res gets the value of function with res - so the function works the second fase of the check                
                res = checkNum(res);
                checkNum(res);
            }
            if (res == 1&&temp==num) {
                System.out.println( num+"is happy");
                counter += 1;
             }
            else{
                counter=0;
            }
             temp=num+1;
            num+=1;
        }
    }
//function that returns the first fase of happy num check
    public static int checkNum (int num){
       int result = 0;
       while (num>0){
           result += (num%10)*(num%10);
           num=num/10;
           }
            return result;
    }
}

Raw Text