Color Interpolation Not working [Help required]

I have implemented a simple triangle program but somehow triangle is drawn in a single color which is color of first vertex.

Code is like this

GLfloat positions[] = {

0.0f, 0.0f,0.0f,
1.0f, 1.0f,0.0f,
-1.0f, 1.0f,0.0f,

};

GLfloat colors[] = {

0.0f,1.0f,0.0f,   // Color
0.0f,1.0f,0.0f,   // Color
0.0f,0.0f,1.0f,   // Color

};

glGenBuffers(1,&vertexBufferId);
glBindBuffer(GL_ARRAY_BUFFER,vertexBufferId);
glBufferData(GL_ARRAY_BUFFER,sizeof(positions),positions,GL_STATIC_DRAW);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0,3,GL_FLOAT,GL_FALSE,0,0);

glGenBuffers(1,&colorBufferId);
glBindBuffer(GL_ARRAY_BUFFER,colorBufferId);
glBufferData(GL_ARRAY_BUFFER,sizeof(colors),colors,GL_STATIC_DRAW);
glEnableVertexAttribArray(1);
glVertexAttribPointer(1,3,GL_FLOAT,GL_FALSE,0,0);

These are my shaders

#version 330
layout(location = 0)in vec3 vert;
layout(location = 1)in vec3 color;

out vec3 frag_color;
void main()
{
gl_Position = vec4(vert,0.0);
frag_color = color;
}

#version 330

out vec4 fragColor;
in vec3 frag_color;
void main()
{
fragColor = vec4(frag_color,1.0);
}

I just see a triangle in green color. Need some help !!!

Don’t see any error, show full code please.

I have found the issue in vertex shader…a small typo wasted 4 hours :frowning:

Replaced
gl_Position = vec4(vert,0.0);
with
gl_Position = vec4(vert,1.0);

Found the issue. Posted on forum. Surprised to see such behavior due to small typo in the vertex shader.