I know its a basic question but anyways

i am getting WA in one of the test cases
question is :- https://hack.codingblocks.com/contests/c/537/50
#include<bits/stdc++.h>
using namespace std;
int main() {
int a,b,c;
cin>>a>>b>>c;

int D = b*b - 4*a*c;

if(D>0){
    cout<<"Real and Distinct"<<endl;
    int x = (-b+sqrt(D))/2*a;
    int y = (-b-sqrt(D))/2*a;
    cout<<x<<" "<<y<<endl;;
}

if(D==0){
    cout<<"Real and Equal"<<endl;
    int x = -b/2*a;
    int y = -b/2*a;
    cout<<x<<" "<<y<<endl;
}

if(D<0){
    cout<<"Imaginary"<<endl;;
}

return 0;

}

https://ide.codingblocks.com/s/43338
In the question if you see the outptut in case of real and distinct they are in increasing order so u need to add a check in ur real and distinct block to ensure that.