Probleme c++
Fermé
ibnking
Messages postés
36
Date d'inscription
jeudi 22 novembre 2007
Statut
Membre
Dernière intervention
19 août 2010
-
26 nov. 2007 à 10:33
fiddy Messages postés 11069 Date d'inscription samedi 5 mai 2007 Statut Contributeur Dernière intervention 23 avril 2022 - 26 nov. 2007 à 19:12
fiddy Messages postés 11069 Date d'inscription samedi 5 mai 2007 Statut Contributeur Dernière intervention 23 avril 2022 - 26 nov. 2007 à 19:12
1 réponse
fiddy
Messages postés
11069
Date d'inscription
samedi 5 mai 2007
Statut
Contributeur
Dernière intervention
23 avril 2022
1 816
26 nov. 2007 à 19:12
26 nov. 2007 à 19:12
Salut,
Cdt
#include <iostream>
using namespace std;
int main(){
int *tableau;
int N;
cout << "N=";
cin >> N;
tableau = new int [N];
cout << "choix des " << N << "entiers" << endl;
int i=0;
while(i<N)
cin >> tableau[i++];
int somme=0;
i=0;
while(i<N)
somme+=tableau[i++];
cout << "la moyenne est : " << (float)somme/N << endl;
return 0;
}
Cdt