English, asked by kundaneur8492, 9 months ago

Ryan is appearing for a techathon that offers price money of 10K for the winner. Techathon has provided a platform where an incomplete code will appear, and the participants have to complete it. Ryan got a program where he needs to create a complex calculator. Can you help Ryan win this competition? The first line consists of a choice which is an integer to choose from 1 to 3. Choice 1 represents addition of two complex numbers, 2 represents subtraction of two complex numbers and 3 represents the multiplication of two complex numbers.

Answers

Answered by premanandnayak2671
0

Answer:

बुड्ढा घे ट्यूबीजेकेे

Answered by nidaeamann
0

Answer:

Explanation:

The program in C langauge is

include <stdio.h>

struct complexnum

{

  int real, img;

};

void main(void)

{

  struct complexnum a, b, c;

 int operand

  printf("Enter a and b as first complex input in the form of a + ib ");

  scanf("%d%d", &a.real, &a.img);

  printf("Enter c and d as second complex input ");

  scanf("%d%d", &b.real, &b.img);

  printf("Enter the integer as operand");

  scanf("%d", &operand);

 

  if (operand == 1)   // Addition

  {

  c.real = a.real + b.real;

  c.img = a.img + b.img;

 }

  elseif (operand == 2)   //  Subtraction

  {

  c.real = a.real - b.real;

  c.img = a.img - b.img;

 }

   elseif (operand == 3)   //  Multiplication

  {

  c.real = (a.real x b.real) - (a.img x b.img) ;

  c.img = (a.real x b.img) + (a.img x b.real) ;

 }

 

  printf("The output complex number: (%d) + (%di)\n", c.real, c.img);

  return ;

}

Similar questions