9511_workbook

solved exercises from algorithms & programming I (9511) prof. Cardozo
Index Commits Files Refs README
guia02/ex06.c (378B)
   1 #include <stdio.h>
   2 #include <ctype.h>
   3 
   4 int main(void)
   5 {
   6     int alpha, nonalpha, num;
   7     int c;
   8     
   9     alpha = nonalpha = num = 0;
  10 
  11     while((c = getchar()) != EOF ) {
  12         if(isalpha(c))
  13             alpha++;
  14         else if(isdigit(c))
  15             num++;
  16         else if(!isalnum(c))
  17             nonalpha++;
  18     }
  19     printf(
  20         "Alphanumerics: %d\n"
  21         "NonAlphanumerics: %d\n"
  22         "Digits: %d\n",
  23         alpha, nonalpha, num
  24     );
  25 
  26     return 0;
  27 }