Advertisement
Guest User

pala

a guest
Jan 26th, 2015
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. #include <stdlib.h>
  2. #define TAILLE 225
  3.  
  4. main(){
  5. int liste[TAILLE],i=0,nbValeur=0,palindrome=1;
  6. do {
  7. system ("CLS");
  8. printf ("\07\07");
  9. printf("\nNombres entier: ");
  10. scanf("%d", &nbValeur);
  11. }while (nbValeur <1 || nbValeur > TAILLE);
  12. for (i=0; i<nbValeur;i++) {
  13. printf("\nValeur du tableau num %d: ", i+1);
  14. scanf("%d",&liste[i]);
  15.  
  16. }
  17. i=0;
  18.  
  19. while (i<nbValeur/2 && palindrome ==1) {
  20. if (liste[i]!= liste[nbValeur-i-1]) palindrome=0;
  21. i = i + 1;
  22. }
  23. printf ("\n\n");
  24. if (palindrome==1) printf ("\n\n\t votre tableau est un palindrome");
  25. else printf("Votre tableau n'est pas un palindrome");
  26. printf ("\n\n\t");
  27. system("PAUSE");
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement