0% found this document useful (0 votes)
4 views1 page

Complex Add

The document contains a C program that defines a structure for complex numbers and provides a function to add two complex numbers. It prompts the user to input the real and imaginary parts of two complex numbers, performs the addition, and outputs the result in the format 'a+bi'. The program demonstrates basic input/output operations and function usage in C.

Uploaded by

kavinmukhilb
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Complex Add

The document contains a C program that defines a structure for complex numbers and provides a function to add two complex numbers. It prompts the user to input the real and imaginary parts of two complex numbers, performs the addition, and outputs the result in the format 'a+bi'. The program demonstrates basic input/output operations and function usage in C.

Uploaded by

kavinmukhilb
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

#include <stdio.

h>

typedef struct compapp{


int num;
int img;
} complexx;

complexx add(complexx x,complexx y)


{
complexx z;
[Link]= [Link] + [Link];
[Link]= [Link] + [Link];

return(z);
}

int main()
{
complexx a;
complexx b;
printf("enter the 1st real");
scanf("%d",&[Link]);
printf("enter the 1st img");
scanf("%d",&[Link]);

printf("enter the 2nd real");


scanf("%d",&[Link]);
printf("enter the 2nd img");
scanf("%d",&[Link]);

complexx c=add(a,b);

printf("%d+%di",[Link],[Link]);

return 0;
}

You might also like