Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- #include <conio.h>
- int main()
- {
- float ax2,by,c,x1,x2,x3;
- printf("Podaj wzór funkcji kwadratowej: \n");
- printf("W postacie ax^2+by+c.\n");
- scanf("%f%f%f", &ax2, &by,&c);
- float delta;
- delta = -by*by - 4 * ax2 * c;
- if( delta > 0 )
- {
- x1 = ((-by - sqrt(delta)) / 2 * ax2);
- x2 = ((-by + sqrt(delta)) / 2 * ax2);
- printf("Miejsca zerowe to: %f %f\n",x1,x2);
- getch();
- return 0;
- }
- else if(delta = 0)
- {
- x3 = - by / 2 * ax2;
- printf("Twoje miejsce zerowe to: %f", x3);
- getch();
- return 0;
- }
- else
- printf("Delta ujemna. \n");
- getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment