0% found this document useful (0 votes)
26 views

Java Logic

Uploaded by

Abhay Pawar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Java Logic

Uploaded by

Abhay Pawar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

import java.util.

*;
class productofdigit
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
}
}

Q1>reverse of a number
1>rev=0;
2>while n>0{rev=(rev*10)+n%10;}
3>n=n/10;

Q2>sum of digit
1>sum=0
2>while(n>0){sum=sum+n%10;}
3>n/10;

q3>product of digit
1>product=0
2>while(n>0){product=product*n%10;}
3>n/10;

Q4>palindrome number
1> rev=0;
2> input n;
3> z=n;
4> while(n>0)
{
{rev=rev*10+(n%10);}
n=n/10;
}
5> if (z==rev)
{System.out.println("palindrome number");}
else
{System.out.println(" not a palindrome number");}
}
Q5>prime number
1>

You might also like