Advertisement
mailnesia

Untitled

May 4th, 2015
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.06 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<math.h>
  3.  
  4. float a(){
  5. float a;
  6. printf("Podaj wspolczynnik a: \n");
  7. scanf("%f", &a);
  8. return a;
  9. }
  10. float b(){
  11. float b;
  12. printf("Podaj wspolczynnik b: \n");
  13. scanf("%f", &b);
  14. return b;
  15. }
  16. float c(){
  17. float c;
  18. printf("Podaj wspolczynnik c: \n");
  19. scanf("%f", &c);
  20. return c;
  21. }
  22. float wyznacznik(float d, float e, float f){
  23.     float wynik;
  24. wynik=pow(e,2)-4*d*f;
  25. return wynik;
  26. }
  27. void dane (){
  28. a();
  29. b();
  30. c();
  31. }
  32. void przetworz(){
  33.     float delta,ab,bc,ce,x1,x2,x;
  34.    ab=a();
  35.     bc=b();
  36.     ce=c();
  37.  
  38.  
  39.    delta=wyznacznik(ab,bc,ce);
  40. if (delta<0)
  41.     {
  42.         printf("Rownanie nie posiada rozwiazania w zbiorze liczb rzeczywistych");
  43.     }
  44. if (delta==0)
  45.     {
  46.         x=(-bc)/2*ab;
  47.         printf("Rozwiazaniem jest X=%f",x);
  48.     }
  49. if (delta>0)
  50.     {
  51.         x1=(-bc-sqrt(delta))/2*ab;
  52.         x2=(-bc+sqrt(delta))/2*ab;
  53.         printf("Rozwiazaniem jest X1= %f lub X2= %f", x1,x2);
  54.  
  55.     }}
  56.  
  57.  
  58.  
  59. void drukuj(){
  60.  
  61.  
  62. }
  63. main(){
  64.     printf("*********************** Rownania kwadratowe ***********************\n");
  65.     dane();
  66. przetworz();
  67.  
  68. }
  69. #include<stdio.h>
  70. #include<math.h>
  71.  
  72. float a(){
  73. float a;
  74. printf("Podaj wspolczynnik a: \n");
  75. scanf("%f", &a);
  76. return a;
  77. }
  78. float b(){
  79. float b;
  80. printf("Podaj wspolczynnik b: \n");
  81. scanf("%f", &b);
  82. return b;
  83. }
  84. float c(){
  85. float c;
  86. printf("Podaj wspolczynnik c: \n");
  87. scanf("%f", &c);
  88. return c;
  89. }
  90. float wyznacznik(float d, float e, float f){
  91.     float wynik;
  92. wynik=pow(e,2)-4*d*f;
  93. return wynik;
  94. }
  95. void dane (){
  96. a();
  97. b();
  98. c();
  99. }
  100. void przetworz(){
  101.     float delta,ab,bc,ce,x1,x2,x;
  102.    ab=a();
  103.     bc=b();
  104.     ce=c();
  105.  
  106.  
  107.    delta=wyznacznik(ab,bc,ce);
  108. if (delta<0)
  109.     {
  110.         printf("Rownanie nie posiada rozwiazania w zbiorze liczb rzeczywistych");
  111.     }
  112. if (delta==0)
  113.     {
  114.         x=(-bc)/2*ab;
  115.         printf("Rozwiazaniem jest X=%f",x);
  116.     }
  117. if (delta>0)
  118.     {
  119.         x1=(-bc-sqrt(delta))/2*ab;
  120.         x2=(-bc+sqrt(delta))/2*ab;
  121.         printf("Rozwiazaniem jest X1= %f lub X2= %f", x1,x2);
  122.  
  123.     }}
  124.  
  125.  
  126.  
  127. void drukuj(){
  128.  
  129.  
  130. }
  131. main(){
  132.     printf("*********************** Rownania kwadratowe ***********************\n");
  133.     dane();
  134. przetworz();
  135.  
  136. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement