یک رشته از ورودی گرفته چک کند با معکوسش برابر است ؟ - جاوا
package tamrin;
import javax.swing.JOptionPane;
public class Tamrin {
public static void main(String[] args) {
String str =JOptionPane.showInputDialog(null, "input Jomle");
int i;
char c[]=str.toCharArray();
for ( i=0 ; i< str.length() ; i++)
{
if (c[i] == c [(str.length())-i-1])
continue;
else
JOptionPane.showMessageDialog(null,"Barabar nist");
break;
}
if (i== str.length())
JOptionPane.showMessageDialog(null,"Barabar hast");
}
}
import javax.swing.JOptionPane;
public class Tamrin {
public static void main(String[] args) {
String str =JOptionPane.showInputDialog(null, "input Jomle");
int i;
char c[]=str.toCharArray();
for ( i=0 ; i< str.length() ; i++)
{
if (c[i] == c [(str.length())-i-1])
continue;
else
JOptionPane.showMessageDialog(null,"Barabar nist");
break;
}
if (i== str.length())
JOptionPane.showMessageDialog(null,"Barabar hast");
}
}
+ نوشته شده در 2013/5/5 ساعت ۱۰:۵۳ ب.ظ توسط وحید
|
با سلام امید دارم که همه شما خوبان خوب باشید از اینکه به مطاله مطالب این بلاگ می پردازید بسیار ممنون هستم امیدوارم مطالب با نظرات شما عزیزان بهتر شود وحید..