#include <iostream> #include <cmath> int main() { double P, S; // Prompt the user for the perimeter and area std::cout << "Įveskite stačiakampio perimetrą (P): "; std::cin >> P; std::cout << "Įveskite stačiakampio plotą (S): "; std::cin >> S; // Calculate the sides of the rectangle double a, b; // Calculate a and b using the quadratic formula a = (P + sqrt(P * P - 16 * S)) / 4; b = (P - sqrt(P * P - 16 * S)) / 4; // Display the results std::cout << "Stačiakampio kraštinės: a = " << a << ", b = " << b << std::endl; return 0; }