Multiplication Of A Given Numbers Elements by using Java Program
Code:
import java.util.*;
public class Multiplication
{
public static void main(String[] args)
{
int n,s=1;
Scanner sc = new Scanner(System.in);
System.out.print("\nEnter The Number : ");
n = sc.nextInt();
while(n!=0)
{
s=s*(n%10);
n=n/10;
}
System.out.println("\nThe Multiplication Of The Number Is : "+s+"\n");
}
}
Output of program:
import java.util.*;
public class Multiplication
{
public static void main(String[] args)
{
int n,s=1;
Scanner sc = new Scanner(System.in);
System.out.print("\nEnter The Number : ");
n = sc.nextInt();
while(n!=0)
{
s=s*(n%10);
n=n/10;
}
System.out.println("\nThe Multiplication Of The Number Is : "+s+"\n");
}
}
Output of program:
No comments