Write statements in Java that would accept a 6 digit number and change the position of digits as shown below and store it in another integer variable. Ensure that the number is not divisible by 10, 100 or 1000.
Answers
Answered by
1
Explanation:
Bsbebehshhshshddhhdhdhdhdhdhhgdgdvjdjdndndjjdndndjddndndndjjddjdjjd
Answered by
0
Answer:
import java.util.*;
class question1 // Write statements in Java that would accept a 6 digit number and change the position of digits as shown below
//and store it in another integer variable. Ensure that the number isnot divisible by 10, 100 or 1000
{
public static void main ()
{
Scanner sc = new Scanner(System.in);
System.out.println("enter a six digit number");
int x = sc.nextInt();
if(x%10==0||x%100==0||x%1000==0)
System.out.println("invalid no.");
else{
int d = x%1000;
x/=1000;
x+=d*1000;
System.out.println(x);
}
}
}
Explanation:
Similar questions