505组作业

输入一个字符,若为大写字母则转化为小写字母,小写字母转化为大写字母,其他原样输出

#include <stdio.h>
main()
{ int ch;
  printf("输入一个字符\n");
  scanf("%c",&ch);
  if(ch>='A'&&ch<='Z') ch=ch+32; 
  else if(ch>='a'&&ch<='z') ch=ch-32;
  else ch=ch;
  printf("%c\n",ch);
  return 0;    
}

 

猜你喜欢

转载自www.cnblogs.com/ljh26/p/10631458.html