0

Hi ! can someone from you explain what's wrong here 😊 ?!

this code should be used to verify a palindrome number ---- #include <stdio.h> int nb ; int extrait(int nb); int est_palindrome (int nb ); int main(){ scanf("%d \n", &nb); printf("la valeur que tu as donne est : %d \n",nb); if (est_palindrome(nb)== 1){ printf("le nombre est palindrome "); } else printf("le nombre n'est pas palindrome "); } int extrait (int nb){ int static *p; p=&nb ; int cpt , m , i ; m= nb ; do { cpt = cpt + 1 ; nb = nb / 10 ; }while (nb >=9 ); return(nb); for (i=1;i<cpt ;i++){ nb = nb * 10 ; } *p = (m - nb) ; } int est_palindrome (int nb){ while (nb >= 9 ){ if (extrait(nb)!=(nb % 10) ){ return (0); break ; } } if (est_palindrome(nb)!= 0 ){ return(1) ; } }

26th May 2020, 5:13 PM
Imane Bouasria
1 Réponse
+ 3
Both of your functions int extrait(int nb) int est_palindrome(int nb ) Don't have return statements at the end of them. int extrait(int nb) { .... ..... do { .... } while (); return nb; for() { .... } .... // need return statement here }
26th May 2020, 7:54 PM
ChaoticDawg
ChaoticDawg - avatar