Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #define S 256
- int isPalyndrom( char s[S])
- {
- int i;
- int check=0;
- int c1=0;
- while (s[check] !='\0')
- check++;
- for (i=0;i<check;i++)
- {
- int j=check-1;
- if (s[i]==s[j])
- {
- check--;
- }
- else
- {
- c1=0;
- break;
- }
- c1++;
- }
- if (c1>0)
- printf("\n\n%s is a Palina(?)drom \n",s);
- else
- printf("\n\n%s is No_0T a Palina(?)drom \n",s);
- return (0);
- }
- void SwitchLetters( char s[S])
- {
- int i,j,temp;
- int check=0;
- //size of actual sing
- while (s[check] !='\0')
- check++;
- //checking of the sing
- for(i=0,j=1; i < check ; i++,j++)
- {
- {
- if(s[j] == s[i]+1)
- {
- temp = s[i];
- s[i] = s[j];
- s[j] = temp;
- }
- }
- if (check-i==1)
- break;
- }
- printf("%s\n",s);
- }
- void main()
- {
- char s[S];
- printf("\n\n---*Enter jibrish*---\n");
- gets (s);
- s[S]=isPalyndrom(s);
- SwitchLetters(s);
- /*void RemoveChar (char s[S], char ch);
- int ss( char s1[S] , char s2[S] );
- int sing2Integer (char s[S]);
- */
- }
Add Comment
Please, Sign In to add comment