Line | |
---|
1 | #include "stdio.h" |
---|
2 | |
---|
3 | /////// |
---|
4 | int main() |
---|
5 | { |
---|
6 | int opx; |
---|
7 | int res; |
---|
8 | int i; |
---|
9 | |
---|
10 | tty_puts(" TASK 1 : FACTORIELLE \n"); |
---|
11 | |
---|
12 | while (1) { |
---|
13 | tty_puts("\n*********************\n"); |
---|
14 | tty_puts("operand = "); |
---|
15 | tty_getw_irq(&opx); |
---|
16 | tty_puts("\n"); |
---|
17 | if( (opx > 12) || (opx < 1) ) { |
---|
18 | tty_puts("operand must be larger than 0 and smaller than 13\n"); |
---|
19 | } else { |
---|
20 | res = 1; |
---|
21 | for(i=opx ; i>1 ; i--) res = res*i; |
---|
22 | tty_printf("factorielle(%d) = %d\n", opx, res); |
---|
23 | } |
---|
24 | } |
---|
25 | return 0; |
---|
26 | } // end main |
---|
Note: See
TracBrowser
for help on using the repository browser.