Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace S1MoyennesExo11
- {
- class Program
- {
- static void Main(string[] args)
- {
- //Poser 10 questions à l'utilisateurs :
- //Saisissez un nombre *10 :
- //Donner la moyenne.
- //int[] reponse = new int[10];
- //reponse = Question(reponse);
- //float resulat = Moyenne(reponse);
- //Console.WriteLine("La moyenne est : " + (resulat / 10));
- //QuestionSansT();
- // 10 Questions sans boucles :
- //Console.WriteLine("Saisissez un chiffre : ");
- //int reponse01 = Convert.ToInt32(Console.ReadLine());
- //Console.WriteLine("Re Saisissez un chiffre : ");
- //int reponse02 = Convert.ToInt32(Console.ReadLine());
- //Console.WriteLine("Saisissez un chiffre : ");
- //int reponse03 = Convert.ToInt32(Console.ReadLine());
- //Console.WriteLine("Saisissez un chiffre : ");
- //int reponse04 = Convert.ToInt32(Console.ReadLine());
- //Console.WriteLine("Saisissez un chiffre : ");
- //int reponse05 = Convert.ToInt32(Console.ReadLine());
- //Console.WriteLine("Saisissez un chiffre : ");
- //int reponse06 = Convert.ToInt32(Console.ReadLine());
- //Console.WriteLine("Saisissez un chiffre : ");
- //int reponse07 = Convert.ToInt32(Console.ReadLine());
- //Console.WriteLine("Saisissez un chiffre : ");
- //int reponse08 = Convert.ToInt32(Console.ReadLine());
- //Console.WriteLine("Saisissez un chiffre : ");
- //int reponse09 = Convert.ToInt32(Console.ReadLine());
- //Console.WriteLine("Saisissez un chiffre : ");
- //int reponse10 = Convert.ToInt32(Console.ReadLine());
- // Reponse sans boucles :
- //float resultat = (reponse01 + reponse02 + reponse03 + reponse04 + reponse05 + reponse06 + reponse07 + reponse08 + reponse09 + reponse10) / 10;
- //Console.WriteLine("La moyenne est " + resultat);
- int addition = 0;
- int plusPetit = 100;
- int plusGrand = 0;
- for (int i = 0; i < 10; i++)
- {
- Console.WriteLine("Saisissez un chiffre : ");
- int reponse = Convert.ToInt32(Console.ReadLine());
- addition = reponse + addition;
- if (plusPetit > reponse)
- {
- plusPetit = reponse;
- }
- else if (plusGrand < reponse)
- {
- plusGrand = reponse;
- }
- }
- float moyenne = addition / 10;
- Console.WriteLine("La moyenne est de : " + moyenne);
- Console.WriteLine("La note la plus petite est : " + plusPetit);
- Console.WriteLine("La note la plus grande est : " + plusGrand);
- Console.ReadLine();
- }
- static int[] Question (int[] reponse)
- {
- for (int i = 0; i < 10; i++)
- {
- Console.WriteLine("Saisissez un chiffre : ");
- reponse[i] = Convert.ToInt32(Console.ReadLine());
- }
- return reponse;
- }
- static int Moyenne(int[] reponse)
- {
- int resultat = 0;
- for (int i = 0; i < reponse.Length; i++)
- {
- resultat = reponse[i] + resultat;
- }
- return resultat;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement