Page 207 - Computer science 868 Class 12
P. 207
12 n = nn;
13 }
14 int sum_sq_digits(int x)
15 {
16 while(x > 0)
17 {
18 d = x%10;
19 s = s + d*d;
20 x = x/10;
21 }
22 return(s);
23 }
24
25 void ishappy()
26 {
27 int a;
28 while(n > 9)
29 {
30 s = 0;
31 n = sum_sq_digits(n);
32 }
33 if(n== 1)
34 System.out.println("Happy No.");
35 else
36 System.out.println("Not a Happy No.");
37 }
38
39 public static void main()
40 {
41 Scanner sc=new Scanner(System.in);
42 int num;
43 System.out.println("Enter a number ");
44 num=sc.nextInt();
45 Happy ob = new Happy();
205
Statements and Scope 205

