Exercice langage C : Les Suites et les Séries
Rédigé par GC Team, Publié le 16 Mars 2012, Mise à jour le Samedi, 17 Décembre 2022 21:32Participez au vote ☆☆☆☆☆★★★★★
a)
#include
using namespace std;
int main(int argc, char **argv)
{
float U = 1;
cout << "U0 = " << U << endl;
for (int n = 1; n <= 10; n++) {
U = U / n;
cout << "U" << n << " = " << U << endl;
}
return 0;
}
b)
#include
using namespace std;
int main(int argc, char **argv)
{
float U = 1;
float V = U;
cout << "U0 = " << U << endl;
for (int n = 1; n <= 10; n++) {
U = U / n;
V = V + U;
cout << "U" << n << " = " << U << endl;
cout << "V" << n << " = " << V << endl;
}
return 0;
}