Skip to content

Instantly share code, notes, and snippets.

@Ambratolm
Created June 25, 2017 12:16
Show Gist options
  • Save Ambratolm/58b29fee950a0af513bc704ffe9e09c8 to your computer and use it in GitHub Desktop.
Save Ambratolm/58b29fee950a0af513bc704ffe9e09c8 to your computer and use it in GitHub Desktop.
Ecrire l’algorithme qui cherche la plus grande valeur parmi trois nombres saisis par l’utilisateur.
#include<stdio.h>
main()
{
printf("--------------------------\n");
printf("Max de 3 nombres\n");
printf("--------------------------\n");
printf("\n");
float a,b,c, m,max;
printf("Entrez le premier nombre: ");
scanf("%f",&a);
printf("Entrez le deuxième nombre: ");
scanf("%f",&b);
printf("Entrez le troisième nombre: ");
scanf("%f",&c);
if (a > b) {
m = a ;
} else {
m = b ;
}
if (m > c) {
max = m ;
} else {
max = c ;
}
printf("\n");
printf("\n");
printf("Le Maximum est: %f", max);
printf("\n");
printf("\n");
system("pause");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment