Advertisement
Guest User

Untitled

a guest
Sep 28th, 2021
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. public class Main {
  2.  
  3.  
  4.  
  5. public static void main(String[] args) {
  6. // write your code here
  7.  
  8. Scanner scan = new Scanner(System.in);
  9.  
  10. int n;
  11. System.out.println("UNESITE N");
  12. n=scan.nextInt();
  13. int length=String.valueOf(n).length()-1;
  14. int result=0;
  15.  
  16. while (n>0){
  17. int reminder=(int) (n/(Math.pow(10,length)));
  18.  
  19. if(reminder%2==0){reminder=5;}
  20. result+=reminder*(int)Math.pow(10,length);
  21. n=n%(int) Math.pow(10,length);
  22. length--;
  23. }
  24. System.out.println(result+" result");
  25.  
  26.  
  27.  
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement