Complex number:
Example :
2+3i
0+4i
-1-9i
These kind of number are known as complex number.
where 'i' is root -1.
How make complex number ?
We need two thing :
-real part of complex number number
-imaginary part of complex number
Syntax-
a+bi
Where 'a' is the real part.
and 'b' is the imaginary part.
To create a complex number type structure, there are many logic may be possible, one of the way to create a complex number is :
program-
#include< stdio.h>
#include< string.h>
char complex(char r[10], char im[10])
{
char s[2]="+";
char i[2]="i";
s[1]='';
i[1]='';
strcat(r,s);
strcat(r,im);
strcat(r,i);
printf("Complex number is %s",r);
}
int main() {
char s1[10],s2[10];
printf("Enter real and imaginary part of the complex number\n");
scanf("%s%s",&s1,&s2);
complex(s1,s2);
}
Enter real and imaginary part of the complex number
3
4
Complex number is 3+4i