Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- float my_det(float a1, float b1, float a2, float b2) {
- return a1 * b2 - a2 * b1;
- }
- int main(void) {
- //ввод данных
- //...
- float a1, b1, k1, a2, b2, k2;
- //если в промежутке от -0,001 до 0,001 то ответа нет
- float det_denom = my_det(a1, b1, a2, b2);
- if(det_denom > -0.001 && det_denom < 0.001) {
- printf("Solution does not exist");
- return 0;
- }
- //считаем корни
- float first_nom = my_det(k1, k2, b1, b2);
- float second_nom = my_det(a1, a2, k1, k2);
- float first_sol = first_nom / det_denom;
- float second_sol = second_nom / det_denom;
- //выводим
- printf("Solution one - %f\nSolution two - %f", first_sol, second_sol);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement