Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <conio.h>
- int main()
- {
- int charCount, counter, i, temp, check,check2;
- char letter[12], letter2[12];
- charCount = 0;
- counter = 10;
- check = 0;
- i = 1;
- check2 = 0;
- printf("Enter your sentinel value.:");
- scanf_s(" %c", &letter[check2]);
- while ((i<13) && (letter[i] != letter[check2]))
- {
- printf("Enter individual letters in word (in order).:");
- scanf_s(" %c", &letter[i]);
- charCount++;
- if (letter[i] == letter[check2])
- {
- break;
- }
- i++;
- }
- printf("Letters entered:%in", charCount);
- for (i = 0; i < charCount; i++)
- {
- letter2[i] = letter[i];
- }
- for (i = 0; i <= (charCount / 2); i++)
- {
- temp = letter2[counter];
- letter2[counter] = letter2[i];
- letter2[i] = temp;
- counter--;
- }
- for (i = 0; i <= charCount; i++)
- {
- if (letter[i] = letter2[i])
- {
- check++;
- }
- }
- if (check = charCount)
- {
- printf("Word is a palindrome.n");
- }
- system("PAUSE");
- return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement