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);
getch();
}
/* 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);
getch();
}
Comments