ofekkfir

4nums + 3 nums for the test

Nov 6th, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.93 KB | None | 0 0
  1. import java.util.*;
  2. public class test
  3. {
  4.     static Scanner reader = new Scanner (System.in);
  5.  
  6.     /**
  7.      * @param args
  8.      */
  9.     public static void main(String[] args)
  10.     {
  11.         System.out.println("enter the num");
  12.         int num = reader.nextInt();
  13.         if (num <= 999){
  14.        
  15.         int meot = num/100;
  16.         int asarot = (num/10)%10;
  17.         int yehidot = num%10;
  18.         if (yehidot == meot)
  19.         {
  20.             System.out.println ("The num is palindrom");
  21.         }
  22.         if (meot != yehidot)
  23.         {
  24.             System.out.println ("The num isn't palindrom");
  25.         }
  26.         System.out.println(meot + asarot+ yehidot );
  27.         System.out.println ( meot*100 + asarot*10 +yehidot);
  28.         if (num%33 == 0)
  29.         {
  30.             System.out.println ("sherit 33");
  31.         }
  32.         if (num%33 != 0)
  33.         {
  34.             System.out.println (" lo sherit 33");
  35.         }
  36.         if (num%3 == 0)
  37.         {
  38.             System.out.println ("mithalek be 3");
  39.         }
  40.         if (num%3 != 0)
  41.         {
  42.             System.out.println (" lo mithalek be 3");
  43.         }
  44.         if (num>0)
  45.         {
  46.             System.out.println (num);
  47.         }
  48.         if (num <= 0)
  49.         {
  50.             System.out.println (num*-1);
  51.         }
  52.        
  53.         }
  54.         if (9999 >= num  && num >1000){
  55.            
  56.             int alpiot = (num/1000);
  57.             int meot = ((num/100)%10);
  58.             int asarot = ((num/10)%10);
  59.             int yehidot = num%10;
  60.             if (yehidot == alpiot && asarot == meot )
  61.             {
  62.                 System.out.println ("The num is palindrom");
  63.             }
  64.             if (yehidot != alpiot)
  65.             {
  66.                 System.out.println ("The num isn't palindrom");
  67.             }
  68.             System.out.println(alpiot + meot+ asarot +yehidot );
  69.             System.out.println ( alpiot + asarot*10 +asarot*100 +yehidot*1000);
  70.             if (num%33 == 0)
  71.             {
  72.                 System.out.println ("sherit 33");
  73.             }
  74.             if (num%33 != 0)
  75.             {
  76.                 System.out.println (" lo sherit 33");
  77.             }
  78.             if (num%3 == 0)
  79.             {
  80.                 System.out.println ("mithalek be 3");
  81.             }
  82.             if (num%3 != 0)
  83.             {
  84.                 System.out.println (" lo mithalek be 3");
  85.             }
  86.             if (num>0)
  87.             {
  88.                 System.out.println (num);
  89.             }
  90.             if (num <= 0)
  91.             {
  92.                 System.out.println (num*-1);
  93.             }
  94.            
  95.            
  96.             }
  97.        
  98.        
  99.        
  100.  
  101.     }
  102.  
  103. }
Advertisement
Add Comment
Please, Sign In to add comment