WAP
of
to
even
input a number . Display the product of the successor
digits of the number entered
Input: 2745
Output:15
Answers
Answer:
6ub the runnel a good day I extend the runnel a good day I extend the runnel a good day 556
Write a program to input a number.Display the product of the successors of even digits of the number entered
Explanation:
Java Program
import java.util.*;
public class product
{
public static void main()
{
Scanner sc=new Scanner(System.in);
int n,r,p=1;
System.out.println("Enter a number"); // Input number
n=sc.nextInt();
while(n!=0)
{
r=n%10;
n=n/10;
if(r%2==0)
{
System.out.println("\n"+"Even digit = "+r);
System.out.println("Its successor = "+(r+1)+"\n");
p = p * (r+1);
}
}
System.out.println("\n"+"The product of successors of the digit is "+p);
}
}
Output
Enter a number 2745
Even digit =
2
4
The product of successors of the digit is :3*5=15