摘要: 1.编写程序,使用while语句求和sum=1+3+5+7+…+21. #include<stdio.h> main() { int a=1,sum=0; while(a<=21) { sum+=a; a+=2; } printf("sum=%d\n",sum); } 2.编写程序,使用while语 阅读全文
posted @ 2021-11-02 22:44 ᯤ⁶ºᴳ⁺ 阅读(38) 评论(0) 推荐(0)
摘要: 1.编写程序,使用scanf()函数接收整形、实型、字符型的变量,并分行依次输出 #include<stdio.h> main() { int a; float b; char c; scanf("%d%f%c",&a,&b,&c); printf("%d\n%f\n%c\n",a,b,c); } 阅读全文
posted @ 2021-11-02 22:37 ᯤ⁶ºᴳ⁺ 阅读(49) 评论(0) 推荐(0)