This is a program to find robotic arm inv kinematics. my doubt is not in kine:-). My program executes but always prints "position unacheivable", even for a known value, it does the same. here I have used radians for angles since thats what c understands. Please tell me how to come across this or even tell me better method to implement this. Thank you.

insertCode:#include<stdio.h> #include<math.h> #include<conio.h> void main() { float a, b, c, d; int x = 0, y = 0, z = 0; int x1 = 0, y1 = 0, z1 = 0; int i = 0; printf("Enter X value: \n"); scanf("%d", &x); printf("Enter Y value: \n"); scanf("%d", &y); printf("Enter Z value: \n"); scanf("%d", &z); for (a = -1.74 ; a <= 1.74 ; a = a + 0.02) { for (b = 0.0; b <= 3.14; b = b + 0.02) { for (c = -1.74; c <= 1.74; c = c + 0.02) { for (d = -0.784; d <= 0.784; d = d + 0.02) { x1 = (int)((11*cos(d+c+b+a)+11*cos(d+c+b-a)+12*cos(c+b+a)+12*cos(c+b-a)+9*cos(b+a)+9*cos(b-a))/2); if(x1 == x) { y1 = (int)((11*sin(d+c+b+a)-11*sin(d+c+b-a)+12*sin(c+b+a)-12*sin(c+b-a)+9*sin(b+a)-9*sin(b-a))/2); if(y1 == y) { z1 = (int)(11*sin(d+c+b) + 12*sin(c+b) + 9*sin(b)); if(z1 == z) { i = 1; goto status; } } } } } } } status: if(i == 0) printf("*****Positon unacheivable*****"); else printf(" The joint angles for the desired positon are %d \t %d \t %d \t %d \n", a, b, c, d); getch(); }