int temp = rand() % 30 + 1; 이렇게 하면 1 이상 ~ 30 이하 중의 무작위 수를 int 형식의 temp 변수에 넣는 구문이 되는 건가요? 네, 맞습니다.
include <stdio.h> include <stdlib.h> include <time.h> int main() { int a; srand((unsigned int)time(NULL)); int percent = rand() % 100; if(percent < 30) { a=1; } else if(percent < 30) { a=2;...
안녕하세요 저는 요즘 c언어 공부하는 사람입니다. 제가 만드는 프로그램에서 랜덤함수를 쓰는데 srand(time(NULL)); rand()%99+9; 이런식으로 쓰거든요? 그런데 그...