Can I write histogram equalization, blurring, sharpening grayscale image etc.. as shader programs with openGL? unsigned int histogram[256]={0};
for(int i=0;i&lt;width*height;i++)  //to iterate over pixels
  ++histogram[image[i]];

const float cutoffpercentage = 0.05;  //To cut off lower and upper values
unsigned char lowerbound,upperbound;
unsigned int histAccu =0;  //pixel entries &lt; 5% =lower bound
const unsigned int lowerpercentile = cutoffpercentage * width*height;
const unsigned int upperpercentile = (1-cutoffpercentage)*width*height;

for(int h =0;h &lt;256;h++){
histAccu += histogram[h];

if(histAccu &lt;= lowerpercentile){
lowerbound = h;
continue;
}

if(histAccu &gt;= upperpercentile){
upperbound = h;
break;
}
}

Then assign new gray values. Can I write this program to equalize the histogram of an image on a gpu shader memory and programs for image segmentation, blurring, sharpening etc...as a shader program using openGL ?? Can we write shader programs just like a normal application program in C ?? Kindly help me on this, as I'm new to shader programming.
Yes you can. There are basically two approaches:

You draw everything to a framebuffer object. Then you apply image processing fragment shaders to resulting texture of the previous draw call, where the shaders take the pervious texture with a sampler.

or if you have a particular image and you would like to have more control on the numeric precision, the number of neighbours available to you while working on pixel etc:

You apply compute shaders directly to image.

For the first approach, see Learn OpenGL, for compute shaders, see Anton's tutorial