Cielo Benítez / Mbed 2 deprecated practica4_ejer5_copy_copy2

Dependencies:   mbed

main.cpp

Committer:
cielo
Date:
2020-04-12
Revision:
25:ca5fce342593
Parent:
24:7f14b70fc9ef

File content as of revision 25:ca5fce342593:

#include <stdio.h>
#define letra_a 97 // A EN MINUSCULA
#include<iostream>
#include<mbed.h>

//PARA REPETIR LA SUMA PRESIOAR "a" y luego enter.
using namespace std;
Serial com1(USBTX,USBRX); // PARA USAR LOS PINES UART
int main()
{
    int sum1=0;
    int num,i,auxcon;
    char letra;
   
   
    com1.printf("ingrese un numero entero: ");
    com1.scanf("%d",&num);
                   
    while (1)
    {
        letra=getchar();
       
        if (letra == letra_a) 
        {
           auxcon=num;  
            for(i=1;i<=5;i++)
                 {
                auxcon++;
                sum1=sum1+auxcon;
                 }
                 com1.printf("La suma de los 5 numeros cosecutivos es:%d \n",sum1);  
    
    }
        }
    }