//AN INTERESTING GAME TO PLAY USING MADE SRAND & RAND FUNCTION //
#include<stdio.h>
#include<stdlib.h>
#include<time.h>//to use rand & srand function..time.h header file is used..//
time_t sec;//declare variable of time_t
int main()
{
int i,num,die,j=0;
char choose='\0';
time(&sec);//enter the address of variable in time function declared in time.h......//
printf("sec=%d\n",(int)sec);//print secs that is value in time_t type by typecasting it to int//
srand((unsigned int)sec);//put value into srand function now//
do
{
for(i=0;i<10;i++)
{
printf("ENTER THE DIE..NO %d \n",i);
scanf("%d",&die);//enter a number from outside//
num=rand()%7;//rand() function is divided by 7 & if i have to obtain the value upto 7....then every time according to system time ...after putiing a variable in time() function & srand function() ...rand()%7 which is modules of 7....if u want to get value upto 7....every time when rand function is called ,a diffrent number (upto 7)is obtained...
if(num==die)//if u entered number(die) == num obtained by rand function...that means u will be able to get 2 points
{
j=j+2;
printf("******CONGRETS U WIN*****YOU GOT %d POINTS\n",j);//(HIGH-LOW+1)+LOW//HIGH=6 LOW=1
}
}
printf("DO YOU WANT TO PLAY AGAIN:PRESS y\n");
scanf("%d",&choose);//if u want to proceed further to play again...//