Posted By

sebastianf on 02/01/10


Tagged

function uppercase lowercase getchar putchar


Versions (?)

uppercase input to lowercase output


 / Published in: C
 

  1. /* output in lowercase */
  2.  
  3. #include <stdio.h>
  4.  
  5. int lower(int upper);
  6.  
  7. int main(int argc, const char *argv[]){
  8. int c;
  9. c=getchar();
  10. while(c != EOF){
  11. if(c<65 || c>90){
  12. putchar(c);
  13. c=getchar();
  14. }
  15. else{
  16. putchar(lower(c));
  17. c=getchar();
  18. }
  19. }
  20. }
  21.  
  22. int lower(int upper){
  23. upper=upper+32;
  24. return(upper);
  25. }

Report this snippet  

You need to login to post a comment.