C Code for Normal Distribution

This c programming code is used to find the normal distribution. 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 normal distribution.

#include<stdio.h>
#include<math.h>
int main()
{ 
  double x,y,w,Z_MAX=6,mean,sd,z;
  mean=100,x=106,sd=6;
  if(mean<x)
  y=x-mean;
  else
  y=mean-x;
  z=y/sd;  
  if (z == 0.0) 
  {
  x = 0.0;      
  } 
  else 
  {
  y = 0.5 *z;        
  if(y > (Z_MAX * 0.5)) 
  {
  x = 1.0;
  } 
  else if (y < 1.0) 
  {
  w = y * y;
  x = ((((((((0.000124818987 * w - 0.001075204047)* w 
           + 0.005198775019) * w - 0.019198292004)* w
           + 0.059054035642) * w - 0.151968751364)* w 
           + 0.319152932694) * w - 0.531923007300)* w 
           + 0.797884560593) * y * 2.0;
   } 
   else 
   {
    y -= 2.0;
    x = (((((((((((((-0.000045255659 * y
           + 0.000152529290) * y - 0.000019538132) * y
           - 0.000676904986) * y + 0.001390604284) * y
           - 0.000794620820) * y - 0.002034254874) * y
           + 0.006549791214) * y - 0.010557625006) * y
           + 0.011630447319) * y - 0.009279453341) * y
           + 0.005353579108) * y - 0.002141268741) * y
           + 0.000535310849) * y + 0.999936657524;
    }   
    if (z>0.0)
    z=(x+1.0)*0.5;
    else
    z=(1.0-x)*0.5;
    }
    printf("Normal Distribution:%.4f",z);
 }
Other Programming Codes
Online Calculator : Normal Distribution
Click on the select code link to copy and paste this free c program code for normal distribution.

english Calculators and Converters


Sitemap