Fascinating Number program Solved ISC practical 2021 Question 1

Fascinating Number program

https://wordpress-343193-1101484.cloudwaysapps.com/frequency-of-letters

import java.util.*;
class Fascinating
{
  void mergnum(int n)
     {
        int a  = n*2;int mergnum;
        int b = n*3;
        String n1,n2,n3;String m;
        n1 = Integer.toString(n);
        n2 = Integer.toString(a);
        n3 = Integer.toString(b);
        m = n1+n2+n3;
        mergnum = Integer.valueOf(m);
    }
     boolean isFacinating()
     {
        int c = 0;
        int i = 0;
        char ch[] = {'1','2','3','4','5','6','7','8','9'};
        char temp = ch;
        int flag = 0;
        while(mergnum>0)
        { int rem = mergnum%10;
            if(rem == (int)temp[i])
            {
                temp[i]=' ';
                c++;
                i++;
            }
            else
            {
                i++;
            }
            mergnum = mergnum/10;
            if(c==9)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    public static void main()
    {
        Fascinating obj  = new Fascinating();
        Scanner sc = new Scanner(System.in);
        System.out.println("Enter the lower limit greter then 99");
        int lo = sc.nextInt();
        System.out.println("Enetr the upper limit less then 10000");
        int ul = sc.nextInt();
        int count = 0; System.out.println("THE FASCINATING NUMBERS ARE ");
        if(ul<lo||ul>10000||lo<99) 
        {
            System.out.println("INVALID INPUT");
        }
        else
        {     
           
            for(int j = lo;j<ul;j++)
            {
                if(isFascinating(j))
                {
                   if(count>0)
                    {
                          System.out.println(j);}
                     
                       if(count==0)
                    {
                             System.out.println("NULL");}
                    
                    }
                count++;
                System.out.println("THE FREQUENCY OF THE FASCINATING NUBERS IS : "+count);
            }}}
Fascinating number program

http://www.youtube.com/trushnatej

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top