36 lines
595 B
C
36 lines
595 B
C
/* Conversion en majuscules */
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
|
|
void majuscule(char*);
|
|
|
|
int main() {
|
|
char phrase[100];
|
|
int i = 0;
|
|
|
|
printf("Entrez une phrase en minuscules : ");
|
|
fgets(phrase, 100, stdin);
|
|
while (phrase[i] != '\n') {
|
|
i++;
|
|
}
|
|
phrase[i] = '\0';
|
|
|
|
printf("%s\n", phrase);
|
|
majuscule(phrase);
|
|
printf("%s\n", phrase);
|
|
|
|
return 0;
|
|
}
|
|
|
|
void majuscule(char* phrase) {
|
|
int i = 0;
|
|
|
|
while (phrase[i] != '\0') {
|
|
if ((phrase[i] >= 'a') && (phrase[i] <= 'z')) {
|
|
phrase[i] -= 32;
|
|
}
|
|
i++;
|
|
}
|
|
}
|