How to remove the last comma in comma separated prime numbers within a range in C? : I have the code for finding prime numbers within a range.
The problem is to remove the last comma.

    #include<stdio.h>

    int main()
    {
        int a,b,i,x,c,f=1;
        scanf("%d%d",&a,&b);
        for(x=a;x<=b;(x++,f=0))
        {
       
            for(i=2;i<x;i++)
            {
                if(x%i==0)
                {
                     f=1;
                }
       
            }
                if(f==0)
                    printf("%d,",x);
            }
      }

But the output contains an extra comma in the last.
For example 

> 2,3,5,7,

whereas the expected output is 

> 2,3,5,7
