Ask a Question | Answer a Question! |
![](/img/l.gif)
Submitting your question...
ResFinder - Thousands of Practice Papers
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!");
}
} |
![](//pl.respaper.com/64/rochana_hm3.jpg) |
asked by Rochan HM (rochana_hm3) 7 years ago |
2 |
any1 still alive........i mean awake.[lol]
now the doubt ...explain Sring args[]. |
![](//pl.respaper.com/64/jayant002.jpg) |
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? |
![](//pl.respaper.com/64/sam_01.jpg) |
asked by Samyukta Narasimhan (sam_01) 7 years ago |
1 |
+ 1 more questions by sam_01
in a series program where the two loops are concerned, is the outer loop generally for determining the number of spaces and the inner loop for the elements of the loop? |
![](//pl.respaper.com/64/sam_01.jpg) |
asked by Samyukta Narasimhan (sam_01) 7 years ago |
1 |
|
Can we use .split function in Boards ? |
![](//pl.respaper.com/64/gogeta120201.jpg) |
asked by Vedant Singh (gogeta120201) 7 years ago |
1 |
Anybody going 2 burn midnight oil tonight??? |
![](//pl.respaper.com/64/oisix.jpg) |
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 |
![](//pl.respaper.com/64/sharmamanoj860.jpg) |
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? |
![](//pl.respaper.com/64/tanayk.jpg) |
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. |
![](//pl.respaper.com/64/drij5860.jpg) |
asked by Drij Vaghasia (drij5860) 7 years ago |
2 |
Somebody please upload selection sort and binary search program using bufferedreader |
![](//pl.respaper.com/64/ajinsumesh.jpg) |
asked by Icse (ajinsumesh) 7 years ago |
1 |
All the best to every1 for tomorrow! |
![](//pl.respaper.com/64/anurag45.jpg) |
asked by Officer Tenpenny (anurag45) 7 years ago |
1 |