Last change
on this file since 167 was
165,
checked in by alain, 12 years ago
|
Introducing various modifications in kernel initialisation
|
File size:
869 bytes
|
Line | |
---|
1 | #include "stdio.h" |
---|
2 | |
---|
3 | ///////////////////////////////////////// |
---|
4 | __attribute__ ((constructor)) void main() |
---|
5 | { |
---|
6 | unsigned int opx; |
---|
7 | unsigned int opy; |
---|
8 | |
---|
9 | giet_tty_printf(" Interactive PGCD \n"); |
---|
10 | |
---|
11 | while (1) |
---|
12 | { |
---|
13 | giet_tty_printf("\n*******************\n"); |
---|
14 | giet_tty_printf("operand X = "); |
---|
15 | giet_tty_getw( &opx ); |
---|
16 | giet_tty_printf("\n"); |
---|
17 | giet_tty_printf("operand Y = "); |
---|
18 | giet_tty_getw( &opy ); |
---|
19 | giet_tty_printf("\n"); |
---|
20 | if( (opx == 0) || (opy == 0) ) |
---|
21 | { |
---|
22 | giet_tty_printf("operands must be larger than 0\n"); |
---|
23 | } |
---|
24 | else |
---|
25 | { |
---|
26 | while (opx != opy) |
---|
27 | { |
---|
28 | if(opx > opy) opx = opx - opy; |
---|
29 | else opy = opy - opx; |
---|
30 | } |
---|
31 | giet_tty_printf("pgcd = %d\n", opx); |
---|
32 | } |
---|
33 | } |
---|
34 | } // end pgcd |
---|
35 | |
---|
Note: See
TracBrowser
for help on using the repository browser.