Trending ▼   ResFinder  

ICSE − Q & A

ICSE
Indian Certificate of Secondary Education (ICSE), New Delhi
+Fave Message

Ask a Question

Answer a Question!

ResFinder - Thousands of Practice Papers

bye ATB.
my midnight fuel finished 😂😂😂🤣
asked by Anushagh (anushagh) 7 years ago
2

+ 1 more questions by anushagh  

Guys try this logic for Fascinating Number; I've broken down the program into bits so that it'll be easier to comprehend. Its done using Strings,Arrays,Sorting and checking...

import java.util.*;
class Fascinating
{
    public static void main()
    {
        //accepting
        System.out.println("Enter Number: ");
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        String temp=Integer.toString(n*1)+Integer.toString(n*2)+Integer.toString(n*3);
        int[]a={1,2,3,4,5,6,7,8,9};
        char[]ch=temp.toCharArray();
        
        //sorting
        for(int i=0;i<ch.length-1;i++)
        {
            for(int j=0;j<ch.length-i-1;j++)
            {
                if(ch[j]>ch[j+1])
                {
                    char aa=ch[j];
                    ch[j]=ch[j+1];
                    ch[j+1]=aa;
                }
            }
        }
        
        //counting
        boolean b=false;
        int count=0;
        for(int i=0;i<ch.length;i++)
        {
            
            if(ch[i]==0)
            continue;
            
            else 
            {
                if(((int)ch[i]-48)==a[i]){
                b=true;
                count++;
            }
                
                else 
                b=false;
            }
        }
        
        //printing
		if(b==true&&count==9)
		    System.out.println("Fascinating Number!");
		else
		System.out.println("Not Fascinating Number!");
}
}
asked by Rochan HM (rochana_hm3) 7 years ago
2
any1 still alive........i mean awake.[lol]
now the doubt ...explain Sring args[].
asked by Jayant Chaudhary (jayant002) 7 years ago
1
suppose i wanna input my values in the accept function over the function over loading program, would the buffered reader syntax come under this function or the main function?
asked by Samyukta Narasimhan (sam_01) 7 years ago
1
Can we use .split function in Boards ?
asked by Vedant Singh (gogeta120201) 7 years ago
1
Anybody going 2 burn midnight oil tonight???
asked by Prathamesh Dhake (oisix) 7 years ago
6
Guess please tell how to accept a. String or character through the method of Scanner please answer me fast till 8:05am becoz then I shall go to school leaving my phone at home so if see my question then answer me fast pleassssssse
asked by Manoj Sharma (sharmamanoj860) 7 years ago
1
What is valueOf fn.  used for and for what is parse fns.(like parseInt,parseDouble etc.) Used for???
Reply ASAP with examples plzzzzz?
asked by Tanay Kamath (tanayk) 7 years ago
1
Sdfg paper was too difficult I hope it comes easy paper tomorrow.
Atb to every one.
asked by Drij Vaghasia (drij5860) 7 years ago
2
Somebody please upload selection sort and binary search program using bufferedreader
asked by Icse (ajinsumesh) 7 years ago
1

<< Prev

    Page 158    

Next Page >>

ICSE chat

© 2010 - 2024 ResPaper. Terms of ServiceContact Us Advertise with us