Random and Randomize

Posted by Bl4ckB0y On 05.24 0 comments

/*
We using Dev C++ v 6.0 to make the source codes
Author : Nurul Huda
e-mail : h2d4890@gmail.com
*/
/*using Random and randomize*/
#include "stdio.h"
#include "conio.h"
#include "stdlib.h"
#include "time.h"
/*this function just for palying with programing using C
this program implement random and randomize to make a number
from 0 until 100 and the user must found the number*/
void main()
{
int e;
do{system("cls");
int a,b;
srand((unsigned) time(0));
a=rand()%100;
//printf("\n %d\n",a); //if you want to win. active this function
do{
fflush(stdin);
printf("Insert Number= ");
scanf("%d",&b);
if(b>a)
{
printf("Less\n"); /*the number is too big*/
}
else if (a>b) {printf("More\n");} /*the number is to small*/
else {printf("ok\n");} /*found the number*/
}
while(a!=b);
printf("Congratulation!\n");
printf("Try Again (1=yes) ");
scanf("%d",&e);
}
while(e==1);
}

Categories:

0 Response for the "Random and Randomize"

Posting Komentar

your Ads Here

Your Ad Here FellowEquality.com