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.
Diff: main.cpp
- Revision:
- 31:5c22609a9fe7
- Parent:
- 30:f7518060fc89
diff -r f7518060fc89 -r 5c22609a9fe7 main.cpp
--- a/main.cpp Tue Oct 22 19:20:06 2019 +0000
+++ b/main.cpp Thu Oct 31 04:17:57 2019 +0000
@@ -1,23 +1,14 @@
#include "mbed.h"
Serial pc(USBTX,USBRX);
-
int main(){
- const int filas=3;
- const int columnas=3;
- int matriz [filas][columnas];
- int i,j;
- int contador=0;
-
- for (i=0;i<filas;i++)
- {
- for (j=0;j<columnas;j++)
- { contador = contador+1;
- matriz [i][j]=contador;
- pc.printf("%d\t", matriz[i][j]);
- }
- pc.printf("\n");
- }
-
-
+ unsigned int num, sum, prom;
+ srand(time(NULL));
+ for(int i; i < 10; i++){
+ num = rand() % 900000000;
+ sum = sum + num;
+ pc.printf("Valor numero %d es %d\n", i + 1, num);
+ }
+ prom = sum / 10;
+ pc.printf("\nEl promedio de los valores es: %d \n\n\n", prom);
}
\ No newline at end of file