1. 程式人生 > >8.輸入一個大寫字母,要求小寫字母輸出

8.輸入一個大寫字母,要求小寫字母輸出

 1 #include <stdio.h>
 2 #include <stdlib.h>
 3 
 4 int main()
 5 {
 6     char a,c1;
 7     scanf("%c",&a);
 8     c1 = a+32;   //大寫字母與小寫字母的ASCII碼相差32,‘a’=97,‘A’=97-32=65
 9     printf("%c\n",c1);//%c按字元型輸出
10     printf("%d\n",c1); //%d按十進位制型輸出
11     return 0;
12 }