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();
}
#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();
}
Comments