Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in the file "26. C Struct.md" in code of "Sum of Complex Numbers" #1

Open
ari-i opened this issue Jun 15, 2024 · 1 comment
Open

Comments

@ari-i
Copy link

ari-i commented Jun 15, 2024

No description provided.

@ari-i ari-i changed the title Error in the file "26. C Struct.md" in code of Error in the file "26. C Struct.md" in code of "Sum of Complex Numbers" Jun 15, 2024
@ari-i
Copy link
Author

ari-i commented Jun 15, 2024

IN THIS THE WORD "imagine" SHOULD BE "imag" as that's the defined term.
@Sudip18 @parmaman

The code is:

Sum of Complex Numbers
#include <stdio.h>

typedef struct Complex {
double real;
double imag;
} complex;

int main() {

complex c1 = {.real = 21.87, .imagine = 30};
complex c2 = {.real = 13.34, .imagine = 112.23};

complex sum;

sum.real = c1.real + c2.real;
sum.imagine = c1.imagine + c2.imagine;

printf("Result is %.2lf + %.2lfi", sum.real, sum.imagine);

return 0;
}
Output

Result is 35.21 + 142.23i

PLEASE FIX IT!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant