Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* SCRIVERE UN PROGRAMMA IN C CHE DATA IN INPUT UNA STRINGA NE RESTITUISCA IN OUTPUT LA STRINGA AL CONTRARIO. SE LA STRINGA OTTENUTA E' UGUALE ALL'INIZIALE CONFERMARLO NELLA STAMPA A VIDEO
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int main() {
- int lunghezza, i ,j;
- char stringa[20];
- char stringaf[20];
- printf("Digitare la stringa della quale si vuole ottenere la scrittura speculare: ");
- scanf("%s", &stringa);
- lunghezza=strlen(stringa);
- strcpy(stringaf, stringa);
- for(i=0; i<=lunghezza; i++){ printf("%d", i);
- j=lunghezza;
- stringa[i]=stringa[j];
- strcpy(stringaf, stringa);
- lunghezza--;
- }
- if(stringaf==stringa) printf("Abbiamo ottenuto la stringa: %s. Tale stringa e' palindroma.\n\n", stringaf);
- else printf("Abbiamo ottenuto la stringa: %s . Tale stringa non e' palindroma.\n\n", stringaf);
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement