Aller au contenu

Mathc initiation/a168

Un livre de Wikilivres.


Sommaire


Installer et compiler ces fichiers dans votre répertoire de travail.

c0b3.c
/* ---------------------------------- */
/* save as c0b3.c                     */
/* ---------------------------------- */
#include "x_afile.h"
#include      "fb.h"
/* ---------------------------------- */
int main(void)
{
tvalue n;

  n.min   =  1; 
  n.max   =  9;  
  
double i;

 clrscrn();
 printf(" Compute the %.0f first term of the sequence [a_n]  \n\n\n"
        " a_n : a_1 + (n-1) r \n        %d + (n-1) %d\n\n",
          n.max, A_1, R);

 for(i=n.min; i<=n.max; i++)
 
     printf(" a_%.0f = %+5.0f \n", i, a_n(i));

 printf("\n\n"
        " Partial sum S_n = %s for the sequence a_n.\n\n"
        " S_n = %0.f\n\n", S_aneq, S_an(n.max,A_1,R));        
 stop();

 return 0;
}
/* ---------------------------------- */
/* ---------------------------------- */


Exemple de sortie écran :

 Compute the 9 first term of the sequence [a_n]  


 a_n : a_1 + (n-1) r 
        -4 + (n-1) 3

 a_1 =    -4 
 a_2 =    -1 
 a_3 =    +2 
 a_4 =    +5 
 a_5 =    +8 
 a_6 =   +11 
 a_7 =   +14 
 a_8 =   +17 
 a_9 =   +20 


 Partial sum S_n = [a_1 n + [(n-1)*r)*n] /2 for the sequence a_n.

 S_n = 72

 Press return to continue.