Advertisement
Neo_Feo

Horor_CPP1_Done

Sep 17th, 2023
623
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.85 KB | Source Code | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4.  
  5. typedef struct Result{
  6.     double a,b;
  7. }Result;
  8.  
  9. typedef struct Data{
  10.     double x,y,z;
  11. }Data;
  12.  
  13. Result my_ecuation (Data data){
  14.     Result rezult;
  15.     double x = data.x, y = data.y, z = data.z;
  16.     rezult.a = fabs(x*y*x-sqrt(y)/x*3);
  17.     rezult.b = (y-x)*y - z*y-x*1*(x*y)*2;
  18.     return rezult;
  19. }
  20.  
  21. void printResult(Result ecuation){
  22.     printf("a = %lf\n",ecuation.a);
  23.     printf("b = %lf",ecuation.b);
  24. }
  25.  
  26. Data scanData(){
  27.     Data data;
  28.     printf("Introduceti o valoare pentru x:");
  29.     scanf("%lf",&data.x);
  30.     printf("Introduceti o valoare pentru y:");
  31.     scanf("%lf",&data.y);
  32.     printf("Introduceti o valoare pentru z:");
  33.     scanf("%lf",&data.z);
  34.     return data;
  35. }
  36. int main()
  37. {
  38.     printResult(my_ecuation(scanData()));
  39.     return 0;
  40. }
  41.  
  42. //1.825,18.225,-3.298
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement