WAP to check whether a number is neon number or not
import java.util.*;
class loop{
public static void main(String args[])
{
int n,r=0,m,d;
Scanner ob=new Scanner(System.in);
System.out.println("enter the no:");
n=ob.nextInt();
m=(n*n);
while(m!=0)
{
d=m%10;
r=r+d;
m=m/10;
}
System.out.println(+r);
if(r==n)
System.out.println("neon no");
else
System.out.println("not neon");
}
}
class loop{
public static void main(String args[])
{
int n,r=0,m,d;
Scanner ob=new Scanner(System.in);
System.out.println("enter the no:");
n=ob.nextInt();
m=(n*n);
while(m!=0)
{
d=m%10;
r=r+d;
m=m/10;
}
System.out.println(+r);
if(r==n)
System.out.println("neon no");
else
System.out.println("not neon");
}
}
Comments
Post a Comment