answersLogoWhite

0


Best Answer

import java.io.*;
class MagicNumber
{
public int divide(int x)
{
int a,b=0;
for(int i=x;i>0;i/=10)
{
a=i%10;
b+=a;
}
return b;
}
protected static void main()throws IOException
{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter the number: ");
int a =Integer.parseInt(in.readLine()),b=0,x=1;
MagicNumber l=new MagicNumber();
do
{
if(x==1)
{
b=l.divide(a); x++;
}
else
{
b=l.divide(b);
}
}while((b/10)>0);
if(b==1)
System.out.print("Magic Number!!!!!");
else
System.out.print("Not a Magic Number!!!!!");
}
}

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

import java.io.*;

class smith

{

public static int sumdigit(int n)

{

int i,c=0,s=0;

while(n>0)

{

c+=n%10;

n/=10;

}

return(c);

}

public static int isprime(int n)

{

int i,c=0;

for(i=1;i<=n;i++)

{

if(n%i tot)

System.out.println("Smith Number....");

else

System.out.println("Not Smith Number....");

}

}

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

Download discrepancies

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you write a Program in java to check whether it is a smith number or not?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Where can you cash a Morgan Stanley smith barney check with routing number 044000804?

Where can I cash a morgan stanley smith barney check


Is the serial number on a smith and Wesson revolver?

Check the butt.


Where is serial number on smith and Wesson 38 ctg?

Check the butt.


Where is the serial number on a 44 magnum smith and Wesson?

Check on the butt.


Where is the serial number on a 12 gauge L C Smith shotgun?

Check the receiver


What is Smith Wesson product code 103640 on a revolver?

You will have to find a copy of The Standard Catalog of Smith and Wesson and check each model number.


Where on a 1909 smith and Wesson 38 special revolver is the serial number located?

Check the butt


What year was Smith and Wesson model 29 serial number S2795XX made?

You can check with Smith &amp; Wesson customer Service- (800) 331-0852


How old is a smith Wesson model 629 with serial number 8374xx?

Impossible to answer. What you have listed is not a serial number. CHeck the butt of the weapon for the serial number.


When was Smith and Wesson revolver serial number 118465 made?

Check w/ S&amp;W, or in the Standard Catalog of Smith &amp; Wesson. Data is not otherwise published.


Can you give me any information of a 32 Smith and Wesson serial number 260221?

You will need to provide whether it is a revolver or semi-automatic.


Where will i find the serial number on a smith Wesson 357 model 581?

Check the butt and crane area of the frame.