Zeshin

task1

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