j'ai un programme qui m'inverser ma suite de chiffres
exemple = 123456 j'obtiens 654321
alors que je veux 563412
voici mon code ou es que je me trompe
#include <stdio.h>
main()
{
char caract;
char fullpath[260];
int i,j,longueur_txt_2;
char texte_1 [500];
char texte_2 [500];
char echange;
printf ("jour\n");
gets (texte_1);
strcpy(texte_2,texte_1);
longueur_txt_2 = strlen (texte_2);
j = longueur_txt_2 - 1;
for ( i=0 ; i<=(longueur_txt_2-1)/2 ; i= i +1)
{
echange = texte_2[j];
texte_2[j] = texte_2[i];
texte_2[i] = echange;
j = j-1;
}
puts("\ntexte 1 :\n");
puts(texte_1);
puts("\ntexte 2:\n");
strcpy(fullpath, "in");
strcat(fullpath, texte_2);
puts(fullpath);
printf("\nApuyer sur retour.");
fflush(stdin);
scanf("%c",&caract);
}