[C Language] finding the square root of a number

Last update on October 1, 2009 04:54 PM by aakai1056
Published by aakai1056

[C Language] finding the square root of a number




Intro



A simple C program allowing you to find the square root of a number.


#include <math.h> 
#include <stdio.h> 

int main(void) 
{ 
double x = 4.0, result; 

result = sqrt(x); 
printf("The square root of %lf is %lfn", x, result); 
return 0; 
} 

Notes

  • In this code we make use of the sqrt function, more information available on :
  • Thanks to [TECH] from the forum for this tip.
Best answers for « finding the square root of a number » in :
How to change XP Serial/License number ShowHow to change XP Serial/License number Go to / Start Menu/ Run/ Type regedit and click OK. Before any operation in the registry, he should make a backup of the registry as a precaution In the Registry Editor, click File...
[C language]Checking whether an integer is a prime number Show[C language]Checking whether an integer is a prime number Definition of a prime number Algorithm 1: dividers between 2 and N-1 will be tested Algorithm 2: Even dividers will not be tested, research is limited to odd dividers Algorithm 3:...
SERIAL NUMBER- Trend Micro PC CILLIN ShowSERIAL NUMBER- Trend Micro PC CILLIN Explanation How to replace your old serial number by the new one? Explanation Go to registry by Menu Start > Run and type REGEDIT and click on “OK”. In the open window under « My computer...
NAT- Network address translation, port forwarding and port trigg ShowThe principle of NAT Network address translation or NAT was developed in order to respond to the shortage of IP addresses with IPv4 protocol (in time the IPv6 protocol will respond to this problem). In fact, in IPv4 addressing the number of...
Hardware Interrupts (IRQ) and Conflicts ShowThe Concept of Interrupts Because the processor cannot simultaneously process several pieces of information (it processes one piece of information at a time), a program being run can, thanks to an interrupt request, be momentarily suspended while...
EFQM - European Foundation for Quality Management ShowIntroduction to EFQM The EFQM (European Foundation for Quality Management) is a European foundation based in Brussels that was founded in 1988 by 14 European companies (Bosch, BT, Bull, Ciba-Geigy, Dassault, Electrolux, Fiat, KLM, Nestl, Olivetti,...