SHARE
TWEET

SimmetriyaDerecesi

Mirnijat Mar 26th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.  
  7.         Scanner scan = new Scanner(System.in);
  8.  
  9.         int n = scan.nextInt();
  10.         int cN = n;
  11.         int count = 0;
  12.  
  13.         for (int i = 0; i < cN; cN/=10, count++);
  14.  
  15.         int arr[] = new int[count];
  16.  
  17.         for (int i = 0; i < arr.length; i++, n/=10) arr[i] = n%10;
  18.  
  19.         int simmetriyaDerecesi = 0;
  20.  
  21.         for (int i = 0; i < (arr.length+1)/2; i++){
  22.              if (arr[i] == arr[arr.length - (i+1)]){
  23.                 simmetriyaDerecesi++;
  24.             }
  25.         }
  26.  
  27.         System.out.println(simmetriyaDerecesi);
  28.  
  29.     }
  30.  
  31. }
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