How to Write a C Program to find value of x by Pythagoras Theorem - Complex Number in C Programming Language ?
Solution:
- #include <stdio.h>
- #include <conio.h>
- #include <math.h>
- void main()
- {
- int a,b,c,i,n,j;
- float r,x1,d,x2,e,f,x;
- clrscr();
- printf("Enter Value for a, b and c: ");
- scanf("%d %d %d",&a,&b,&c);
- f=(b/(2*a));
- r=(b*b)-(4*a*c);
- if(r>0)
- {
- d=sqrt(r);
- x=d/(2*a);
- x1=-f+x;
- x2=-f-x;
- printf("x=%.2f, %.2f",x1,x2);
- }
- else
- {
- e=-r;
- d=sqrt(e);
- x=e/(2*a);
- printf("x=(%.2f-i%.2f), (%.2f+i%.2f)",f,x,f,x);
- }
- getch();
- }
Learn More :
Complex Number
Value
- C Program to Demonstrates changing the keypad size and key values.
- C Program To Find The Maximum And Minimum Value In An Array
- C Program To Find Simple Interest
- C Program to Calculation of One Number Raised to Another
- C Program to find result where value and power are user given
- C Program to swap the values of two variables by using call by reference
Pythagoras Theorem
Find
- Find out the perfect number using c program
- Find g.c.d of two number using c program.
- Write a c program to find out NCR factor of given number
- How to Write a C program to find maximum between two numbers ?
- Write a C program to find maximum between three numbers ?
- C or C++ program to read marks of 4 subjects and find how many students are pass and fail with division
- C Program turnLEDOn to Drives Forward Until It Finds The Line
- Write overloaded function templates for finding the roots of the linear (a * x + b = 0) and square (a * x2 + b * x + c = 0) uravneniy.Zamechanie: in function to send coefficients of the equations.
- C Program to Find Random Number
- C Program To Find LCM and HCF Of Two Number Using Function - 2
- C Program to find LCM and HCF Of Two Number Using Recursion - 3
- C Program To Find LCM and HCF Of Two Number -1
- C Program To Find Length Of A String Including Blank Spaces, Tabs, And Other Special Characters
- C Program To Find Length Of String And Concatenate Two Strings
- C Program To Find Product Of Two No Using MACRO
- C Program To Find Reverse Of Any Digit Number
- C Program To Find Sum and Difference Of Two Matrices
- C Program To Find The Frequency Of A Number
- C Program To Find The Length, Reverse Of A String And To Check It Is Palindrome or Not
- C Program To Find The Maximum And Minimum Value In An Array
- C Program To Find Transpose Of A Matrix
- C Program To Find Union & Intersection Of Two Array
- C Program Finding the sum of Squares using Recursion
- C Program to Find NCR Of A Given Number Program
- C Program To Find Maximum Of Given Numbers