Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Exercice 1:
- #include <stdio.h>
- void main(void)
- {
- int T[10];
- int Emax = -1;
- for( int i=0 ; i<10 ; i++ )
- {
- printf("Element %d: ", i+1);
- scanf("%d", &T[i]);
- if(T[i] > Emax)
- Emax = T[i];
- }
- printf("Les indices de Emax = %d dans T sont: ", Emax);
- for( int i=0 ; i<10 ; i++ )
- {
- if(T[i] == Emax)
- printf("%d, ", i+1);
- }
- }
- //Exercice 2:
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h> // toupper();
- void main(void)
- {
- char str[11];
- size_t taille;
- int i, j;
- do
- {
- printf("Enter une chaine de caractere de 10 caractere au maximum: ");
- gets(str);
- taille = strlen(str);
- printf("Taille: %d\n", taille);
- }
- while(taille > 10);
- printf("La chaine %s", str);
- for( i=0, j=taille-1 ; i<j ; i++, j-- )
- {
- if( toupper(str[i]) != toupper(str[j]) )
- break;
- }
- if(i>=j)
- printf(" est un Palindrome");
- else
- printf(" n'est pas un Palindrome");
- }
Add Comment
Please, Sign In to add comment