Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- struct Coords{
- float x;
- float y;
- };
- float distanse(float x1, float y1, float x2, float y2){
- return sqrt(pow((x2 - x1),2) + pow((y2 - y1),2));
- };
- int main(){
- int n;
- scanf("%d", &n);
- struct Coords point[n];
- printf("\n");
- for(int i = 0; i < n; i++){
- printf("%d: ", i + 1);
- scanf("%f %f", &point[i].x, &point[i].y);
- }
- for(int i = 0; i < n; i++){
- printf("\n%d\t", i + 1);
- for(int j = 0; j < n; j++){
- if(i == j)
- printf("X\t");
- else if(i < j)
- printf("%.2f\t", distanse(point[i].x, point[i].y, point[j].x, point[j].y));
- else
- printf("%.2f\t", -distanse(point[i].x, point[i].y, point[j].x, point[j].y));
- }
- }
- int num, num1, k=0, i=0;
- scanf("%d", &num);
- num1 = num;
- while(num1 > 0){
- num1 = num1/10;
- k++;
- }
- int arr[k];
- while(num > 0){
- arr[i] = num % 10;
- num = num/10;
- i++;
- }
- for (i=k-1; i>=0; i--){
- printf("%d", arr[i]);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement