18126

Day1(ex1)

Jul 6th, 2021 (edited)
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.37 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     float a, b, x;
  7.     printf("a = ");
  8.     scanf("%f", &a);
  9.     printf("b = ");
  10.     scanf("%f", &b);
  11.     if(a == 0 && b == 0) {
  12.         printf("x = 0\n");
  13.     } else if (a != 0) {
  14.         x = -b / a;
  15.         printf("x = %.2f\n", x);
  16.     } else {
  17.         printf("No solution. :(");
  18.     }
  19.     return 0;
  20. }
  21.  
Add Comment
Please, Sign In to add comment