Program 1
/**
Write a program to display all the magic composite numbers from 1 to 100.
A magic composite number is a composite number which gives 1 after repeated addition of the digits of
the sum of digits.
Eg : 64 is a magic composite number. Since 6+4=10 and 1+0=1
**/
                                                       ALGORITHM
Step 1: Start
Step 2 : declaration of class
Step 3 : declaration of main()
Step 4 : print “the composite magic numbers are :”
Step 5 : For i←1 to 100 step value 1
a←i
s←i
c←0
For j←1 to a step value 1
If a%j is equal to 0 then c++
End of j loop
while s>9
n←s
s←0
while n>0
d←n%10
s←s+d
n←n/10
End of inner while loop
End of Outer while loop
If s is equal to 1 and c not equal to 2 then print a
End of i loop
Step 6 : Stop
                                                 CODING
import java.util.*;
class MagiCompNumber
{
    public static void main()
    {
        Scanner sc=new Scanner(System.in);
        int a,n,s,d,i,j,c;
        System.out.println("The composite magic numbers from 1 to 100 are :");
        for(i=1;i<=100;i++)
        {
             a=i;
             s=i;
             c=0;
             for(j=1;j<=a;j++)
             {
                     if(a%j==0)
                     c++;
             }//ending of inner loop
             while (s>9)
             {
                 n=s;
                 s=0;
                 while(n>0)
                 {
                      d=n%10;//extracting the digits.
                      s=s+d;
                      n=n/10;
                 }//ending of while loop
             }
              if (s==1&&c!=2)
              System.out.println(a);//printing the magic composite number.
          }
    }
}
                                VARIABLE DESCRIPTION
    SL        VARIABLE DATA        STORAGE SCOPE DESCRIPTION
    NO.       NAME     TYPE
    1.        a           int      4 bytes      local    To store temporarily the number to be
                                                         checked for being magic composite
    2.        n           int      4 bytes      local    To store the number to be checked for magic
                                                         number
    3.        s           int      4 bytes      local    To store the sum of the squares of the digit.
    4.        i           int      4 bytes      local    Used as counter for outer for loop
    5.        j           int      4 bytes      local    Used as counter for outer for loop
    6.        c           int      4 bytes      local    Used for counting the no. of factors
    7.        d           int      4 bytes      local    Used for storing the digits.