Wisdom Materials
Home
About Us
Our Clients
Careers
Services
Education
Jobs
News
Business
Health
Astrology
Entertainment
RealEstate
Devotion
Contact Us
C Programs
/ Complex no addition using structures C program
Program Name
Write a C Program for Complex no addition using structures C program.
Theory
Complex numbers are added by adding real parts first and then adding imaginary parts next.
Program Code
Copy Program Code
#include
struct compno { int r,i; }; void main() { struct compno c1,c2,c3; printf("Enter 1st Complex No"); scanf("%d%d",&c1.r,&c1.i); printf("Enter 2 nd Complex No"); scanf("%d%d",&c2.r,&c2.i); c3.r=c1.r+c2.r; c3.i=c1.i+c2.i; printf("Comlex Number Sum = %d+i%d",c3.r,c3.i); }
Input
Enter 1st Complex No1 2 Enter 2 nd Complex No3 4
Output
Comlex Number Sum = 4+i6
Online C Compiler (To copy paste and Run the c program)
Home
Back