training

Code I wrote during training
git clone git://git.bitsmanent.org/training
Log | Files | Refs | README

hl.c (450B)


      1 /* Exercise 8.6 */
      2 
      3 #include <stdio.h>
      4 #include <ctype.h>
      5 #include <string.h>
      6 
      7 int main(void)
      8 {
      9    int i;
     10    char s[100];
     11 
     12    printf("Give me a string: ");
     13    gets(s);
     14 
     15    printf("Upper: ");
     16    for(i = 0; (unsigned)i < strlen(s); i++)
     17       printf("%c", toupper((int)s[i]));
     18    putchar('\n');
     19 
     20    printf("Lower: ");
     21    for(i = 0; (unsigned)i < strlen(s); i++)
     22       printf("%c", tolower((int)s[i]));
     23    putchar('\n');
     24 
     25    return 0;
     26 } /* E0F main */
     27