C Code for Complex Number

This c programming code is used to find the complex number. You can select the whole c code by clicking the select option and can use it. When you click text, the code will be changed to text format. This c program code will be opened in a new pop up window once you click pop-up from the right corner. You can just copy, paste this c code and use it to find the complex number.

#include<stdio.h>
void main()
{
    int a1,a2,b1,b2,m1,m2,m3,m4,d,r1,s;
    float r,r2,x,y;
    a1=5; b1=2; a2=7;b2=-4;d=0;s=0;    
    //Multiplication of complex number
    m1=a1*a2;
    m2=b1*(-(b2));
    m3=a1*b2;
    m4=a2*b1;
    int m5=(m1+m2);
    int m6=m3+m4;
    if(m6>0)
        printf("
Multiplication of complex num: %d+%di",m5,m6);
    else
        printf("
Multiplication of complex num: %d %di",m5,m6);        
    //Division of complex number   
    d=(a2*a2) +(b2*b2);
    if(m6>0)
         printf("
Division of complex num: (%d+%di)/%d",m5,m6,d);
    else
         printf("
Division of complex num: (%d %di)/%d",m5,m6,d);    
    //Squareroot of complex number
    r1=(5*5)+(2*2);
    r=sqrt(r1);
    r2=(r-a1)/2;
    y=sqrt(r2);
    x=b1/(2*y);
    printf("
Square Root(1): %f +%fi",x,y);
    printf("
Square Root(2):-%f -%fi",x,y);    
}
Other Programming Codes
Online Calculator : Complex Number
Click on the select code link to copy and paste this free c program code for complex number.

english Calculators and Converters


Sitemap