Code:#include <stdio.h>this program supposed to check if a given number prime or not,Code:#include <math.h> int main(void) { int n; int x; printf("enter a number to check if it is prime\n"); scanf("%d",&x); for (n=2;n<=sqrt(x);n++) { if((x%n)==0) { printf("%d not a prime number\n",x); } else { printf("%d prime number\n",x); } } }

when I enter a value bigger than 9 it gives multiple prints, moreover if all those prints say "prime number" yes it is a prime number in real, but if at least one of says "not a prime number" it is not a prime number in real

I tried many things it didn't work. I tried to find a similar code but I couldn't