21~50 범위의 난수 발생시키기

 
#include 
#include 
#include 

void main()
{
	int i, rand_num;

	srand(time(NULL));

	for(i=0; i<10; i++)
	{
		rand_num = rand() %30 + 21;
		printf("[%d]",rand_num);
	}
}

 

 

 

'and so on' 카테고리의 다른 글

Hello world  (0) 2012.06.06
가위바위보  (1) 2012.06.04
girl.  (0) 2012.05.31
모든 플라스틱이 위험한가?  (0) 2011.12.23
[C] delay함수  (0) 2011.09.16