啊哈磊_编程从这里起步

标题: 我是个80后的老人家,求助!!! [打印本页]

作者: jjzwan    时间: 2013-12-23 16:21
标题: 我是个80后的老人家,求助!!!
1.从键盘输入一个正整数,让计算机判断这个数的是否为一位数(1--9)。如果是则输出yes,不是则no.
   刚问了群里的,他们说要用函数,我点都不懂函数,哪里有函数的书籍。。。

作者: 4399APPLE    时间: 2013-12-23 16:21
额,很简单……
  1. #include <stdio.h>
  2. int main()
  3. {
  4. int a;
  5. scanf("%d",&a);
  6. if(a>0&&a<10)
  7. printf("yes");
  8. else
  9. printf("no");
  10. _getch();
  11. return 0;
  12. }
复制代码

作者: 超神级    时间: 2013-12-23 20:40
{:soso_e100:}函数很简单..你以后就知道了
作者: LeoGuozichuan    时间: 2014-2-21 21:57
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. int main()
  4. {

  5. int a;
  6. scanf("%d",&a);
  7. if(a>0&&a<10)
  8. printf("yes");

  9. else

  10. printf("no");

  11. _getch();

  12. return 0;
复制代码






欢迎光临 啊哈磊_编程从这里起步 (https://bbs.codeaha.com/) Powered by Discuz! X3.2