[ create a new paste ] login | about

Link: http://codepad.org/r4y58kpl    [ raw code | output | fork ]

C, pasted on Apr 20:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<time.h>
#include<Windows.h>
int main()
{
	// Random trong đoạn [a, b] 
	int a = 1, b = 20;
	srand(time(0));   // Reset lại thời gian
	for (int i = 1; i <= 12; i++)
	{ 
		
		Sleep(1000);     // Dừng 1 giây
	int x = a + rand() % (b - a + 1);
	printf("\nx = %d", x);
	}
	_getch();
	return 0;
}


Output:
1
2
3
4
Line 17: error: conio.h: No such file or directory
Line 19: error: Windows.h: No such file or directory
In function 'main':
Line 11: error: 'for' loop initial declaration used outside C99 mode


Create a new paste based on this one


Comments: