10-Topshiriq
Download 0.63 Mb.
|
lochin
- Bu sahifa navigatsiya:
- Kiruvchi ma’lumotlar
- Kiruvchi ma’lumotlar Chiquvchi ma’lumotlar
- Kiruvchi Chiquvchi
10-Topshiriq.
package com.company; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("Matnni kiriting: "); String word = scanner.nextLine().toLowerCase(); if (isPalindrome(word)) { System.out.println("YES"); } else { System.out.println("NO"); } } public static boolean isPalindrome(String str) { int i = 0, j = str.length() - 1; while (i < j) { if (str.charAt(i) != str.charAt(j)) { return false; } i++; j--; } return true; } } 10.Matnli fayldagi so‘zlarni ulardagi simvollar soni bo‘yicha kamayish va o‘sish tartibida chiqaring. Bunda satr uzunligi 200 va har bir so‘zning uzunligi 10 bo‘lishi mumkin. Masalan,
import java.util.Scanner; public class Main{ public static void main (String [] args){ Scanner sc=new Scanner (System .in ); String s; s=sc.nextLine(); for(int i =0;i System.out.println("2014 yil Sog‘lom bola yili !"); } } } } Download 0.63 Mb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling