Can we get imaginary numbers as output through 'c' language? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can we get imaginary numbers as output through 'c' language?

I mean by means of any code Pls answer this .....

16th Oct 2021, 11:29 AM
Manoj kumar Vaduka
Manoj kumar Vaduka - avatar
7 Answers
+ 1
you can declare the variable like, double complex z = x + y * I; its a bit difficult to mention all the stuff here :| but try this, https://stackoverflow.com/questions/6418807/how-to-work-with-complex-numbers-in-c I think it will help you :)
17th Oct 2021, 5:07 PM
Rusiru Rathmina
Rusiru Rathmina - avatar
+ 5
oh you're talking about imaginary numbers in complex numbers, there is a header file called complex.h, you can use that to work with complex numbers.
17th Oct 2021, 4:25 PM
Rusiru Rathmina
Rusiru Rathmina - avatar
+ 2
if you mean random numbers, you can use rand() function.
17th Oct 2021, 3:53 PM
Rusiru Rathmina
Rusiru Rathmina - avatar
+ 2
Thank you ❤
17th Oct 2021, 5:37 PM
Manoj kumar Vaduka
Manoj kumar Vaduka - avatar
0
Thank you But i mean if i get a result as imaginary numbers as the solution of a quadratic equation can we get the output....???
17th Oct 2021, 4:17 PM
Manoj kumar Vaduka
Manoj kumar Vaduka - avatar
0
Ooo ok thank you❤
17th Oct 2021, 4:46 PM
Manoj kumar Vaduka
Manoj kumar Vaduka - avatar
0
Can you please mention the format specifiers and function should be used for complex numbers please!!!
17th Oct 2021, 4:56 PM
Manoj kumar Vaduka
Manoj kumar Vaduka - avatar