Initial Basics – Geometry – Problem #10
IIT Kharagpur CS10001 / CS11001 Programming and Data Structures Lab Question Archive
Problem Statement
Complex numbers are represented geometrically as a point in a 2D Argand plane, where the x-axis denotes the real part and the y-axis denotes the imaginary part. Take input one complex number from the keyboard. Hence reflect this complex number in the Argand plane with respect to the vertical y-axis. (a) Display the reflected complex number in the form “a + ib” (i.e if the real part is 2 and the imaginary part is -5 then you should display “2-i5” on the screen). (b) Additionally, display the area enclosed by the rectangle between the horizontal x-axis (the real axis) and the straight horizontal line connecting the two complex numbers, i.e the original and the reflected complex number. The other two sides of the rectangle are the vertical height of the imaginary part of the two complex numbers. [Hint: For input, maintain two separate variables, one denoting the real and the other imaginary part for one complex number. You can assume all integer variables.]