这个C代码有什么问题?

程序员

这是我试图编译的代码

#include <stdio.h>

int main(void)
{
   int n;
   printf("Enter the value for the nuber to be tested\n");
   scanf("%d", &n);
   if(n <=10 && >= 1)
       printf("n is between 1 to 10\n");
   return 0;
}

所以当我编译它时,它在一行显示了一个错误 if(n <=10 && >= 1)

P0W

修正您的scanf

scanf("%d", &n);

并检查是否n在[1,10]范围内

您应该使用

if (n <= 10  && n >= 1) {
//Your Code
}

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章