Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- struct rownanie
- {
- float a;
- float b;
- float c;
- };
- int main()
- {
- struct rownanie r1;
- struct rownanie r2;
- printf("Podaj pierwsze rownanie w formacie: Ax+By=C\nPodaj A: ");
- scanf("%f", &r1.a);
- printf("Podaj B: ");
- scanf("%f", &r1.b);
- printf("Podaj C: ");
- scanf("%f", &r1.c);
- printf("Podaj drugie rownanie w formacie: Ax+By=C\nPodaj A: ");
- scanf("%f", &r2.a);
- printf("Podaj B: ");
- scanf("%f", &r2.b);
- printf("Podaj C: ");
- scanf("%f", &r2.c);
- int w,wx,wy;
- w = r1.a*r2.b - r1.b*r2.a;
- wx = r1.c*r2.b - r1.b*r2.c;
- wy = r1.a*r2.c - r1.c*r2.a;
- if(w!=0)
- {
- printf("x = %f\ny = %f", (float)wx/w, (float)wy/w);
- }
- else
- {
- if(wx==0&&wy==0)
- {
- printf("nieskonczenie wiele rozwiazan");
- }
- else
- printf("uklad sprzeczny");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement