Flow Chart:-
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<math.h>
main()
{
int x, y, z, x1, y1, z1, x2, y2, z2;
double r, l, d, A;
clrscr();
printf("Enter x, y, z, co-ordinates of the centre of the sphere\n");
scanf("%d%d%d",&x,&y,&z);
printf("Enter x1, y1, z1, co-ordinates \n");
scanf("%d%d%d",&x1,&y1,&z1);
printf("Enter x2, y2, z2, co-ordinates \n");
scanf("%d%d%d",&x2,&y2,&z2);
r=sqrt(pow((x-x1),2)+pow((y-y1),2)+pow((z-z1),2));
d=sqrt(pow((x1-x2),2)+pow((y1-y2),2)+pow((z1-z2),2));
A = 2 * asin(d / (2 * r));
l=(r * A);
printf("\nThe smallest arc length between the given points on the sphere is %f limits",l);
getch();
}
OUTPUT :-
Enter x, y, z, co-ordinates of the centre of
the sphere
Enter x1, y1, z1, co-ordinates
3 2 3
Enter x2, y2, z2, co-ordinates
1 0 3
The smallest arc length between the given
points on the sphere is 3.141593 limits
0 Comments