Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp@0:a9edb328dd9c, 2020-04-11 (annotated)
- Committer:
- thesad
- Date:
- Sat Apr 11 01:43:48 2020 +0000
- Revision:
- 0:a9edb328dd9c
- Child:
- 1:b6b079534178
Mis primeras practicas.3
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| thesad | 0:a9edb328dd9c | 1 | #include "mbed.h" |
| thesad | 0:a9edb328dd9c | 2 | #include <stdio.h> |
| thesad | 0:a9edb328dd9c | 3 | #include <iostream> |
| thesad | 0:a9edb328dd9c | 4 | #include <math.h> |
| thesad | 0:a9edb328dd9c | 5 | |
| thesad | 0:a9edb328dd9c | 6 | Serial com1(USBTX, USBRX); |
| thesad | 0:a9edb328dd9c | 7 | |
| thesad | 0:a9edb328dd9c | 8 | int potencia(void); |
| thesad | 0:a9edb328dd9c | 9 | |
| thesad | 0:a9edb328dd9c | 10 | |
| thesad | 0:a9edb328dd9c | 11 | int main() |
| thesad | 0:a9edb328dd9c | 12 | { |
| thesad | 0:a9edb328dd9c | 13 | while(1){ |
| thesad | 0:a9edb328dd9c | 14 | int resultado; |
| thesad | 0:a9edb328dd9c | 15 | resultado = potencia(); |
| thesad | 0:a9edb328dd9c | 16 | com1.printf("El numero elevado a la 10 es: %d \n",resultado); |
| thesad | 0:a9edb328dd9c | 17 | } |
| thesad | 0:a9edb328dd9c | 18 | } |
| thesad | 0:a9edb328dd9c | 19 | |
| thesad | 0:a9edb328dd9c | 20 | int potencia(void) |
| thesad | 0:a9edb328dd9c | 21 | { |
| thesad | 0:a9edb328dd9c | 22 | while(1){ |
| thesad | 0:a9edb328dd9c | 23 | int t, b; |
| thesad | 0:a9edb328dd9c | 24 | com1.printf( "Escriba un número: " ); scanf( "%i", &t ); |
| thesad | 0:a9edb328dd9c | 25 | b = t*t*t*t*t*t*t*t*t*t; |
| thesad | 0:a9edb328dd9c | 26 | return b; |
| thesad | 0:a9edb328dd9c | 27 | } |
| thesad | 0:a9edb328dd9c | 28 | } |