See, in your code you have not written printf to take input of "n" from the user. I have written the correct code below with printf in bolded form.
// Sample code to perform I/O:
#include <stdio.h>
int main(){
int num,i,j,k,c=0;
printf("Enter n value = ");
scanf("%d", &num); // Reading input from STDIN
// Writing output to STDOUT
for(j=2;j<num;j++)
{
for(i=2;i<j;i++)
{
if(j%i==0)
c++;
}
if(c==0)
printf("%d ",j);
}
}