: i am new to c.i tried to write a program to find all prime numbers
: between 2 and any given number and print them.i am attaching the
: source code.but everytime i run it,garbage value appears.can anyone
: help me with it?
hello following is the source code for printing the number is prime or not if you want to only print prime number just delete last printf statement after else and also "is aprime number" from its previous printf statement. i am not able to see your source code now but yesterday see it and the is a "&" in printf statement in your while loop.
int check, i, x,y,m;
printf("enter the number upto which check");
for(m=2; m<=check; m++)
printf("%d is prime number\n",m);
else printf("%d is not a prime number\n",m);