Advertisement
Kentoo

Sonya#1.2 rev2.0

Dec 3rd, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.03 KB | None | 0 0
  1. #include "stdio.h"
  2. #include "conio.h"
  3. #include "locale.h"
  4. #include "fstream"
  5. #define _USE_MATH_DEFINES
  6. #include "math.h"
  7.  
  8. int main()
  9. {
  10.     setlocale(LC_ALL, "Rus");
  11.     int c1, c2, c3;
  12.     float s1, s2, A, B, C;
  13.     printf("Введите c1, c2, c3\n");
  14.     scanf("%d%d%d", &c1, &c2, &c3);
  15.     printf("\nВведите s1, s2\n");
  16.     scanf("%f%f", &s1, &s2);
  17.     A = (4.0 / c3) + (c1*1.0 / c2*c3) + (c1*c3*1.0 / c2);
  18.     B = (s1 + c2*1.0 / c1) / (s2 + c2*1.0 / c3) - (1.0 / c1) - (1 / s1);
  19.     C = 1000 * ((s1 + c1) / (s2 + c2) + c3);
  20.     FILE *f = fopen("f12.txt", "w");
  21.     fprintf(f,  "c1 = %d\n", c1);
  22.     fprintf(f, "c2 = %d\n", c2);
  23.     fprintf(f, "c3 = %d\n", c3);
  24.     fprintf(f, "s1 = %f\n", s1);
  25.     fprintf(f, "s2 = %f\n", s2);
  26.     fprintf(f, "A = %f\n", A);
  27.     fprintf(f, "B = %f\n", B);
  28.     fprintf(f, "C = %f\n", C);
  29.     fclose(f);
  30.     printf("c1 = %d\n", c1);
  31.     printf("c2 = %d\n", c2);
  32.     printf("c3 = %d\n", c3);
  33.     printf("s1 = %f\n", s1);
  34.     printf("s2 = %f\n", s2);
  35.     printf("A = %f\n", A);
  36.     printf("B = %f\n", B);
  37.     printf("C = %f\n", C);
  38.     getch();
  39.     return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement