若输入字母c,程序输出结果为;
#include
main()
{charc1,c2;
c1=getchar();
while(c1<97||c1>122)c1=getchar();
c2=c1-32;
printf("%c,%c\n",c1,c2);
}
#include
main()
{charc1,c2;
c1=getchar();
while(c1<97||c1>122)c1=getchar();
c2=c1-32;
printf("%c,%c\n",c1,c2);
}
举一反三
- 分析下列程序运行结果 #include main() { charc1,c2; c1=97;c2=98; printf("c1=%c,c2=%c\n",c1,c2); printf("c1=%d,c2=%d\n",c1,c2); }
- 下列程序运行后的输出结果是【1】 void main() { char c1,c2; for(c1=’0’,c2=’9’;c1 printf(“%c%c”,c1,c2); printf(“\n”); }
- 写出下列程序的运行结果#include"stdio.h"voidmain(){charc1=’a’,c2=’b’;printf("c1=%c,c2=%c",c1,c2);printf("c1=%d,c2=%d",c1,c2);c1=c1-32;c2=c2-32;printf("c1=%c,c2=%c",c1,c2);printf("c1=%d,c2=%d",c1,c2);}
- 下面程序的运行结果为( )。#include [stdio.h]void main(){ char c1,c2; c1='a'; c2='b'; c1=c1-32; c2=c2-32; printf("%c %c",c1,c2);}
- 以下程序的输出结果是( )char c1, c2;c1=65; c2 = 65 + 32 + 1 ;printf ( "%c, %c ", c1, c2 ) ; A: a, B B: A, B C: A, b D: a, b