← Back to Structs
Question 417
Add Two Complex Numbers
Add Two Complex Numbers
Astruct Complexhas integer fieldsre(real part) andim(imaginary part). Adda = {3, 2}andb = {1, 4}component-wise and print the result in the formre+imi(see Expected Output). Use the format string"%d+%di". There is no trailing newline.
Expected Output:
4+6i= newline. No newline after the last line.
Hints4 available
Sign in to use hintsTopics:
Structs
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (p, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.