这个C代码有什么问题?

Pro*_*mer 0 c output

这是我试图编译的代码

#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;
}
Run Code Online (Sandbox Code Playgroud)

因此,当我编译它时,它会在行显示错误 if(n <=10 && >= 1)

P0W*_*P0W 5

修复你的scanf

scanf("%d", &n);

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

你应该使用

if (n <= 10  && n >= 1) {
//Your Code
}
Run Code Online (Sandbox Code Playgroud)