首页 > 其他 > 详细

回文素数

时间:2019-12-07 10:46:24      阅读:64      评论:0      收藏:0      [点我收藏+]

 1 #include<cstdio> 
 2 #include<iostream>
 3 #include<cstring>
 4 using namespace std;
 5 char ch, letter[101];
 6 int i=1;
 7 int main()
 8 {
 9     printf("Input a string:");
10     scanf("%s", letter+1);
11     int a=1, b=strlen(letter+1);
12     b--;
13 //    cin>>ch;
14 //    while(ch!=‘.‘)
15 //    {
16 //        letter[i]=ch;
17 //        i++;
18 //        cin>>ch;
19 //    }
20     while(letter[a] == letter[b]&&(b>=1)) 
21     {
22         a++;
23         b--;
24     }
25     if(b==0) printf("Yes");
26     else printf("No");
27     return 0; 
28 }

想打‘.’也可以。。。(某人说并没有什么用)

回文素数

原文:https://www.cnblogs.com/orange-233/p/12000704.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!