SHARE
TWEET

Untitled

a guest Sep 21st, 2019 97 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. /**
  3.  * Write a description of class Variables here.
  4.  *
  5.  * @author (Lucky Shahin)
  6.  * @version (17-09-2019)
  7.  */
  8. public class Variables
  9. {
  10.     public int reverse(int num){
  11.         if(num>99 && num<1000){
  12.             int lastNum = num%10;
  13.             num = num/10;
  14.             int midNum = num%10;
  15.             num = num/10;
  16.             int firstNum = num%10;
  17.            
  18.             int result = lastNum*100+midNum*10+firstNum;
  19.            
  20.             return result;
  21.         }else{
  22.             System.out.println("You should input 3 digit numbers!");
  23.             return 0;
  24.         }
  25.     }
  26.     public int square(int num){
  27.         if(num>99 && num<1000){
  28.             int kuadNum = num * num;
  29.             return kuadNum;
  30.         }else{
  31.             System.out.println("You don't input 3 digit numbers!");
  32.             return 0;
  33.         }
  34.     }
  35. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top