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