Skip to main content

Posts

Showing posts from October 7, 2012

AUTOCORRELATION PROGRAMME

Manish Kumar MCA/4528/10 /* Thursday Lab Work AUTOCORRELATION PROGRAMME*/ #include void main() { int random[50],i,j,k,m,M,N,flag=1; float temp=0; clrscr(); printf( "Enter parameters:\n" ); printf( "\nEnter Total Random Number N: " );scanf( "%d" ,&N); printf( "\nTable of Random no.:\n" ); for (j=0;j { random[j]=rand()%10; printf( "%d\t" ,random[j]); } while (flag) { printf( "\nEnter i: " );scanf( "%d" ,&i); printf( "Enter m: " );scanf( "%d" ,&m); printf( "Enter M: " );scanf( "%d" ,&M); if ((i+(M+1)*m)<=N) flag=0; else { flag=1; printf( "wrong enteries! Enter the parameters again\n" ); } } for (k=0;k { temp+=random[i+(k*m)] * random[i+(k+1)*m]; } temp-=0.25; printf( "\n\nResult:%f" ,temp); ...

Random Number generation

shubh laxmi   #include #include #include #include #define MAX 100 void main() { int i,m,M,c,a,x[MAX]; float r[MAX]; clrscr(); printf( "enter the value of a c m :-" ); scanf( "%d %d %d" ,&a,&c,&m); printf( "Enter the value of x0:" ); scanf( "%d" ,&x[0]); r[0]=( float )x[0]/m; printf( "r[0]=%.3f\n" ,r[0]); for (i=1;i { x[i]=(a*x[i-1]+c)%m; r[i]= ( float )x[i]/m; } for (i=1;i { if (x[i]!=x[0]) printf( "Random nos are:-%.3f\n" ,r[i]); else break ; } getch(); }

Weibull Binomial and Geo mean distribution

Jainendra Sharma MCA/4531/10  #include #include #include double fact( int n) { if (n<=0) return 1; else return n*fact(n-1); } double geomean( int x, double p, double q) { if (x>0) return pow(q,x-1)*p; else return 0; } double weibpdf( int x, double v, double a, double b) { int n1,p1,q1; if (x==0) return fact(n1)/(fact(x)*fact(n1-x))*pow(p1,x)*pow(q1,n1-x); else return 0; } double poisson( int x, double a) { if (x return 0; else { return (exp(-a)*pow(a,x))/fact(x) ; } } double binomial( int n, double p, int r) { return fact(n)/(fact(n-r)*fact(r))*pow(p,r)*pow(1-p,n-r); } void main() { int ch; double p,q,v,a,b; int x,n; clrscr(); do { printf( "\nExit." ); printf( "\nGeometric Mean." ); printf( "\nWeibull Distribution." ); printf( "\nPoisson Distribution."...