Above is the code which I have used. I know my logic for the descending part is wrong... but the problem is that now even if i choose option d for descending, it still displays ascending. please helpCode:#include "stdafx.h" #include <iostream> using namespace std; int main() { double num1, num2, num3; double temp; char ad; cout << "Enter three numbers: "; cin >> num1 >> num2 >> num3; cout << endl; cout << "Please choose if you want in ascending (a) or decending (d): "; cin >> ad; cout << endl; //Now num1 is less than or equal to num2 if (ad = 'a'){ if (num1 > num2) { temp = num1; num1 = num2; num2 = temp; } cout << "The numbers in the ascending order are: "; if (num3 <= num1) cout << num3 << " " << num1 << " " << num2 << endl; else if (num1 <= num3 && num3 <= num2) cout << num1 << " " << num3 << " " << num2 << endl; else cout << num1 << " " << num2 << " " << num3 << endl; } else if (ad = 'd'){ if (num1 < num2) { temp = num1; num1 = num2; num2 = temp; } cout << "The numbers in the decending order are: "; if (num3 >= num1) cout << num3 << " " << num1 << " " << num2 << endl; else if (num1 >= num3 && num3 >= num2) cout << num1 << " " << num3 << " " << num2 << endl; else cout << num1 << " " << num2 << " " << num3 << endl; } else{ cout << "You have entered an invalid option!"; } system ("PAUSE"); return 0; }