Emmarhose
Uploaded by
6 SLIDES
70 VUES
60LIKES

emma

DESCRIPTION

Presentation

1 / 6

Télécharger la présentation

emma

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Arithmetic Operation Of Arithmetic Operation Of A Complex Using A Complex Using Structure Structure

  2. Simple algebraic addition do no work in the case of Complex Number. Because they have two parts, Real and Imaginary. To add two complex numbers, real part of one number must be added with real part of other and imaginary part one must be added with imaginary part of other. The concept of complex number can be viewed as structure having two members real and imaginary. So to add two complex numbers we use structure addition. If complex1 and complex2 be two structure variables and complex3 be their sum then complex3.real = complex1.real + complex2.real; complex3.imag = complex1.imag + complex2.imag;

  3. CODES

  4. #include<stdio.h> struct comp{ float real; IT'S STUDY TIME float imag; }; struct comp comp1,comp2; struct comp sum_complex(struct comp complex1,struct comp complex2){ struct comp temp; temp.real = complex1.real + complex2.real; temp.imag = complex1.imag + complex2.imag; return temp; } int main(){ struct comp result; printf("Enter Complex Number 1: "); scanf("%f%f",&comp1.real, &comp1.imag); printf("Enter Complex Number 2: "); scanf("%f%f",&comp2.real,&comp2.imag); result = sum_complex(comp1,comp2); printf("The sum is %.2f + i%.2f\n\n", result.real,result.imag); return 0; }

  5. OUT PUT

  6. IT'S STUDY TIME

More Related