Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- float pierwiastek(a,b,c)
- {
- float delta;
- float pierw_delta;
- float x1, x2, x0;
- delta = b*b-4*a*c;
- pierw_delta = sqrt(delta);
- printf ("Delta: %f\n", delta);
- if (delta>0){
- printf("Pierwiastek z delty: %f\n",pierw_delta);
- x1 = (-b-pierw_delta)/2*a;
- x2 = (-b+pierw_delta)/2*a;
- printf ("x1: %f\n", x1);
- printf ("x2: %f\n", x2);
- }
- if (delta == 0){
- x0=-b/2*a;
- printf ("x0: %f\n", x0);
- }
- if (delta<0){
- printf("Brak rozwiazan\n");
- }
- return x0, x1, x2;
- }
- int main() {
- pierwiastek(1,2,3);
- pierwiastek (1,2,1);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement