Showing posts with label Get Random Row y position using C Program. Show all posts
Showing posts with label Get Random Row y position using C Program. Show all posts

Saturday, December 12, 2015

Get Random Row y position using C Program

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


 

Popular Posts