Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.95 KB | None | 0 0
  1. #include "stdafx.h"
  2. # include <stdio.h>
  3. # include <math.h>
  4.  
  5. int main() {
  6.  
  7.     int a, b, c;
  8.     printf("a= ");
  9.     scanf_s(" %d", &a);
  10.     printf("b= ");
  11.     scanf_s(" %d", &b);
  12.     printf("c= ");
  13.     scanf_s(" %d", &c);
  14.  
  15.  
  16.     if (a == 0 && b == 0)
  17.     {
  18.         return 0;
  19.     }
  20.     else
  21.     {
  22.         if (a == 0)
  23.         {
  24.             int x;
  25.             x = -c / b;
  26.             return 0;
  27.         }
  28.         else if (a>0)
  29.         {
  30.             if (c==0)
  31.             {
  32.                 int x1;
  33.                 int x2;
  34.                 x1 = -b / a;
  35.                 x2 = 0;
  36.                 return 0;
  37.             }
  38.             else if (c>0)
  39.             {
  40.                 int re;
  41.                 int d;
  42.                 int im;
  43.                 re = b / (2 * a);
  44.                  int sqrt(b);
  45.                  int fabs(b);
  46.                 d = b * b - (4 * a * c);
  47.                 im = abs(d) / (2 * a);
  48.                 if (d>0)
  49.                 {
  50.                     int x1;
  51.                     int x2;
  52.                     x1 = re + im;
  53.                     x2 = re - im;
  54.                     return 0 ;
  55.                 }
  56.                 else if (d<0)
  57.                 {
  58.                     printf_s("%d %d", re, im);
  59.                     printf_s("%d %d", re, -im);
  60.                 }
  61.                 else
  62.                 {
  63.                     int x1;
  64.                     int x2;
  65.                     x1 = re;
  66.                     x2 = x1;
  67.  
  68.                 }
  69.             }
  70.         }
  71.     }
  72.  
  73.     return 0;
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement