Écrire un programme  qui permet d'afficher le plus grand de trois entiers saisis  au clavier.

******** En Algorithme ********

Algorithme Maximum_Trois_nombres Variables A,B,C,Max :entiers Debut Ecrire(" Entrer A:") Lire(A) Ecrire(" Entrer B:") Lire(B) Ecrire(" Entrer C:") Lire(C) Max ← A Si (B >= Max) alors Max ← B FinSi Si(C >= Max) alors Max ← C FinSi Ecrire("Le Max est",Max) Fin Résultat ==> Entrer un entier A : 8 Entrer un entier B : 3 Entrer un entier C : 1 Le Max est : 8

Retour vers la liste d'exercices

******** En C ********

#include <stdio.h> int main() { int A,B,C,Max; printf(" Entrer A:"); scanf("%d",&A); printf(" Entrer B:"); scanf("%d",&B); printf(" Entrer C:"); scanf("%d",&C); Max = A ; if (B >= Max) Max = B ; if (C >= Max) Max = C ; printf("le Max est %d",Max); return 0; }

Retour vers la liste d'exercices

******** En C++ ********

#include <iostream> using namespace std; int main() { int A,B,C,Max; cout<<" Entrer A:" ; cin>>A; cout<<" Entrer B:" ; cin>>B; cout<<" Entrer C:" ; cin>>C; Max = A ; if (B >= Max) Max = B ; if (C >= Max) Max = C ; cout<<" Le Max est "<<Max; return 0; }

******** En Python ********

A = int(input("Entrer un Entier A :")) B = int(input("Entrer un Entier B :")) C = int(input("Entrer un Entier C :")) Max = A if B >= Max : Max = B if C >= Max : Max = C print("Le maximum est ",Max)


******** En JAVA ********

import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner (System.in);
System.out.print("Entrer un entier :");
int A = sc.nextInt();
System.out.print("Entrer un entier :");
int B = sc.nextInt();
System.out.print("Entrer un entier :");
int C = sc.nextInt();

int  Max = A ;
   if (B >= Max)
    Max = B ;
   if (C >= Max)
      Max = C ;
System.out.print("le Max est "+Max);
}
}



********* En C# *******

using System;
public class Ex5 {
public static void Main(string[] args)
{ int A,B,C,Max;
Console.Write("Entrer A:");
A=int.Parse(System.Console.ReadLine());
Console.Write("Entrer B:");
B=int.Parse(System.Console.ReadLine());
Console.Write("Entrer C:");
C=int.Parse(System.Console.ReadLine());
Max = A ;
   if (B >= Max)
    Max = B ;
   if (C >= Max)
      Max = C ;
Console.WriteLine ("Le Max : "+Max);
}
}