MR PROGRAMATOR

Serie de Horner

/******************************************************************/

/*    Nombre del programa : serieHorner.cpp                      */

/*    Autor : Luis Alberto Saucedo Quiroga                       */

/*    Objetivo : Calcular la serie de Horner S = x + x^2 + x^N   */

/*    Fecha : 30/04/2012                                         */

/******************************************************************/

#include "stdafx.h"

int main(void)

{

      float x,N,P,S;

      int i;

      printf("n  SERIE DE HORNER");

      printf("nIngrese un numero y su potencia : ");

      scanf_s("%f%f",&x,&N);

      S = 0;

      P = x;

      for(i = 1; i<=N; i++)

      {

            S = S + P;

            P = P*x;

      }

      printf("nLa suma es %5.2fn",S);

      return 0;

}


Este sitio web fue creado de forma gratuita con PaginaWebGratis.es. ¿Quieres también tu sitio web propio?
Registrarse gratis