Where have i gone wrong?

I have made a programme to print prime numbers between 1-100. Its not showing desired output. Please help.

int a=1,b;

for(a=1; a<=100;a++)

{ for(b=2; b<=a/2; b++) 

{if(a%b==0)

{printf("\n%d",a);

break;}}}

if(a%b==0)//???

{printf("\n%d",a);//These 2 statements are root of all error.

It seems more like program to print all non prime numbers :confused: The correct code is easily googleable, so i recommend you searching for it.

Thank you so much.

//