2023-12-04 15:24:40 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <math.h>
|
2023-12-04 15:56:21 +01:00
|
|
|
#include "main_rovnice.h"
|
2023-12-04 15:24:40 +01:00
|
|
|
|
|
|
|
int trojuholnikalgo(int a, int b, int c) {
|
|
|
|
if (((a + b) > c) && ((a + c) > b) && ((b + c) > a)) {
|
|
|
|
printf("Trojuholník sa dá zostrojiť");
|
|
|
|
return 1;
|
|
|
|
} else {
|
|
|
|
printf("Trojuholník sa nedá zostrojiť");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void trojuholniktyp(int a, int b, int c) {
|
|
|
|
//rovnostranny
|
|
|
|
if (a == b && a == c) {
|
|
|
|
printf(" a je rovnostranný\n");
|
|
|
|
}
|
|
|
|
//rovnoramenny
|
|
|
|
else if (a == b || a == c || b == c) {
|
|
|
|
printf(" a je rovnoramenný");
|
|
|
|
}
|
|
|
|
//pravouhly
|
|
|
|
else if ((pow(a, 2) + pow(a, 2)) == pow(c, 2) || (pow(b, 2) + pow(c, 2)) == pow(a, 2) || (pow(a, 2) + pow(c, 2)) == pow(b, 2)) {
|
|
|
|
printf(" a je pravouhlý");
|
|
|
|
}
|
|
|
|
//nic z toho
|
|
|
|
else {
|
|
|
|
printf(" a je rôznostranný");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void trojuholnik() {
|
|
|
|
int a = 0;
|
|
|
|
int b = 0;
|
|
|
|
int c = 0;
|
|
|
|
|
|
|
|
printf("Zadaj číslo:");
|
|
|
|
scanf("%d", & a);
|
|
|
|
printf("Zadaj číslo:");
|
|
|
|
scanf("%d", & b);
|
|
|
|
printf("Zadaj číslo:");
|
|
|
|
scanf("%d", & c);
|
|
|
|
if (trojuholnikalgo(a, b, c) == 1) {
|
|
|
|
trojuholniktyp(a, b, c);
|
|
|
|
}
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void rovnicapriamky() {
|
|
|
|
int a = 0;
|
|
|
|
int b = 0;
|
|
|
|
int x = 0;
|
|
|
|
int y = 0;
|
|
|
|
|
|
|
|
printf("Zadaj A:");
|
|
|
|
scanf("%d", & a);
|
|
|
|
printf("Zadaj B:");
|
|
|
|
scanf("%d", & b);
|
|
|
|
|
|
|
|
printf("Rovnica priamky je y = %d * x + %d\n", a, b);
|
|
|
|
|
|
|
|
printf("Zadaj súradnicu bodu x:");
|
|
|
|
scanf("%d", & x);
|
|
|
|
printf("Zadaj súradnicu bodu y:");
|
|
|
|
scanf("%d", & y);
|
|
|
|
|
|
|
|
if (((a * x) + b) == y) {
|
|
|
|
printf("Bod [%d; %d] leží na priamke y = %d * x + %d.\n", x, y, a, b);
|
|
|
|
} else {
|
|
|
|
printf("Bod [%d; %d] neleží na priamke y = %d * x + %d.\n", x, y, a, b);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-04 15:56:21 +01:00
|
|
|
int rovnice() {
|
2023-12-04 15:24:40 +01:00
|
|
|
|
|
|
|
//trojuholnik();
|
|
|
|
rovnicapriamky();
|
|
|
|
return 0;
|
|
|
|
}
|