Débutant programmation
Fermé
Foly.K6
-
7 déc. 2009 à 16:44
Apaachee Messages postés 248 Date d'inscription mardi 13 novembre 2007 Statut Membre Dernière intervention 25 août 2011 - 8 déc. 2009 à 11:18
Apaachee Messages postés 248 Date d'inscription mardi 13 novembre 2007 Statut Membre Dernière intervention 25 août 2011 - 8 déc. 2009 à 11:18
A voir également:
- Débutant programmation
- Logiciel de programmation pour débutant - Guide
- Programmation - Guide
- Programmation logo tortue télécharger - Télécharger - Études & Formations
- Top44rbn programmation - Forum Programmation
- Programmation binaire - Guide
6 réponses
Apaachee
Messages postés
248
Date d'inscription
mardi 13 novembre 2007
Statut
Membre
Dernière intervention
25 août 2011
47
7 déc. 2009 à 16:47
7 déc. 2009 à 16:47
Essaye :
int main ()
{
int i;
long nombre=10, somme=0;
for (i=0; i<100; i+=10){
printf ("Saisissez le nombre %d ", i+10);
scanf ("%ld", &nombre);
somme+=nombre;
}
printf ("La somme est %ld\n", somme);
system ("pause");
return 0;
}
int main ()
{
int i;
long nombre=10, somme=0;
for (i=0; i<100; i+=10){
printf ("Saisissez le nombre %d ", i+10);
scanf ("%ld", &nombre);
somme+=nombre;
}
printf ("La somme est %ld\n", somme);
system ("pause");
return 0;
}
Apaachee
Messages postés
248
Date d'inscription
mardi 13 novembre 2007
Statut
Membre
Dernière intervention
25 août 2011
47
7 déc. 2009 à 17:39
7 déc. 2009 à 17:39
Résolu ?
Apaachee
Messages postés
248
Date d'inscription
mardi 13 novembre 2007
Statut
Membre
Dernière intervention
25 août 2011
47
7 déc. 2009 à 17:47
7 déc. 2009 à 17:47
Bien sur ? (Résolu sur le premier ^^)
Et s'il s'agissait du produit à calculer.
Voici ce que j'ai fais:
#include <stdio.h>
#include <stdlib.h>
int main ()
{
long int i;
double nombre=10, produit=1;
for (i=0; i<100; i+=10)
{
printf ("Saisissez le nombre %d ", i+10);
scanf ("%ld", &nombre);
produit=produit*nombre;
}
printf ("Le produit est %lf\n", produit);
system ("pause");
return 0;
}
Est-ce juste?
Voici ce que j'ai fais:
#include <stdio.h>
#include <stdlib.h>
int main ()
{
long int i;
double nombre=10, produit=1;
for (i=0; i<100; i+=10)
{
printf ("Saisissez le nombre %d ", i+10);
scanf ("%ld", &nombre);
produit=produit*nombre;
}
printf ("Le produit est %lf\n", produit);
system ("pause");
return 0;
}
Est-ce juste?
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
Apaachee
Messages postés
248
Date d'inscription
mardi 13 novembre 2007
Statut
Membre
Dernière intervention
25 août 2011
47
7 déc. 2009 à 21:02
7 déc. 2009 à 21:02
Ca a l'air correct =)
Apaachee
Messages postés
248
Date d'inscription
mardi 13 novembre 2007
Statut
Membre
Dernière intervention
25 août 2011
47
8 déc. 2009 à 11:18
8 déc. 2009 à 11:18
Oui car tu utilises un double, utilise un int pour un entier =)