• API
• FAQ
• Tools
• Archive
SHARE
TWEET # Untitled a guest Nov 8th, 2019 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. #include <stdio.h>
2. #include <math.h>
3.
4. struct Coords{
5.     float x;
6.     float y;
7. };
8.
9. float distanse(float x1, float y1, float x2, float y2){
10.     return sqrt(pow((x2 - x1),2) + pow((y2 - y1),2));
11. };
12.
13. int main(){
14.     int n;
15.     scanf("%d", &n);
16.     struct Coords point[n];
17.     printf("\n");
18.     for(int i = 0; i < n; i++){
19.         printf("%d: ", i + 1);
20.         scanf("%f %f", &point[i].x, &point[i].y);
21.     }
22.
23.     for(int i = 0; i < n; i++){
24.         printf("\n%d\t", i + 1);
25.         for(int j = 0; j < n; j++){
26.             if(i == j)
27.                 printf("X\t");
28.             else if(i < j)
29.                 printf("%.2f\t", distanse(point[i].x, point[i].y, point[j].x, point[j].y));
30.             else
31.                 printf("%.2f\t", -distanse(point[i].x, point[i].y, point[j].x, point[j].y));
32.         }
33.     }
34.
35.   int num, num1, k=0, i=0;
36.   scanf("%d", &num);
37.   num1 = num;
38.   while(num1 > 0){
39.     num1 = num1/10;
40.     k++;
41.   }
42.   int arr[k];
43.   while(num > 0){
44.     arr[i] = num % 10;
45.     num = num/10;
46.     i++;
47.   }
48.   for (i=k-1; i>=0; i--){
49.     printf("%d", arr[i]);
50.   }
51.   return 0;
52. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Not a member of Pastebin yet?