Advertisement
Guest User

pq-formel

a guest
Oct 18th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.95 KB | None | 0 0
  1. /**********
  2. Name: Verwendung des double Datentyps ( pq Formel
  3. Inahlt: durch Eimgabe , werden erst p und danach q festgelegt,
  4. der Pc rechnet danach die Nullstellen der Funktion aus.
  5. ***********/
  6.  
  7. #include <math.h>
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10.  
  11. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  12.  
  13.  
  14. double p = 0.0;
  15. double q = 0.0;
  16. int main()
  17.  
  18. {  
  19.    
  20.    
  21.    
  22.     double ergebniseins;
  23.     double ergebniszwei;
  24.     //double ergebniszwei;
  25.    
  26.    
  27.     //int ergebnis;
  28.    
  29.     scanf("%lf", &p );
  30.     scanf("%lf", &q);
  31.    
  32.    
  33.  
  34.    
  35.    
  36.    
  37.     printf("Fuer 'P' wurde %lf angegeben und fuer 'q' wurde %lf angegeben ", p,q );
  38.     ergebniseins = -(p/2 ) + sqrt(((p*p)/4)-q);
  39.     ergebniszwei = -(p/2)  - sqrt(((p*p)/4)-q);
  40.     printf("\nNullstelle 1: %.2lf ",ergebniseins);
  41.     printf("\nNullstelle 1: %.2lf ",ergebniszwei);
  42. //printf("ergebnis: %i", ergebnis)  ;
  43.  
  44.  
  45.  
  46. return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement