Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #define nmax 31
- void popola(char s[]);
- void pali(char s[], int l);
- int i;
- main(){
- int n=nmax,lu;
- char str[n],risp;
- do{
- popola(str);
- lu=strlen(str);
- pali(str,lu);
- printf("Se vuoi rieseguire il programma premi y altrimenti premi n\n");
- risp=getch();
- printf("\n\n\n\n");
- }while((risp=='Y')||(risp=='y'));
- }
- void popola(char s[]){
- printf("Inserisci una parola\n");
- gets(s);
- }
- void pali(char s[], int l){
- int t=0;
- for(i=0;i<l/2;i++){
- if(s[i]!=s[(l-1)-i]){
- t=1;
- }
- }
- if(t==1){
- printf("\nLa parola %s non e' palindroma\n\n",s);
- }else{
- printf("\nLa parola %s e' palindroma\n\n",s);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement