Program #27
Description:
Get a random Y (Row) position using C Program.
#include<stdio.h>
#include<stdlib.h>
#include<dos.h>
void main(){
/* Local variable declaration */
int randVal;
/* Clear the Screen */
clrscr();
for (;!kbhit();){
/* get random for Column */
randVal = ( rand() % 100 );
/* randVal range from 0 to 99
but we are expecting ROW value
but it ranges from 1 to 25 only */
if (randVal >= 1 && randVal <= 25){
printf("%d\t", randVal%100);
delay(25);
}
}
getch();
}
Description:
Get a random Y (Row) position using C Program.
#include<stdio.h>
#include<stdlib.h>
#include<dos.h>
void main(){
/* Local variable declaration */
int randVal;
/* Clear the Screen */
clrscr();
for (;!kbhit();){
/* get random for Column */
randVal = ( rand() % 100 );
/* randVal range from 0 to 99
but we are expecting ROW value
but it ranges from 1 to 25 only */
if (randVal >= 1 && randVal <= 25){
printf("%d\t", randVal%100);
delay(25);
}
}
getch();
}