dimanche 27 novembre 2016

My if else is not working

If-Else Write a program that gets three integers and prints the smallest one out. I did it but is not working good

#include <stdio.h>
 void main (void)
 {
double num1,num2,num3;


printf("This program will get three integers and prints the smallest one       \n");
printf("Enter Three integers please \n");
scanf("%lf",&num1);
scanf("%lf",&num2);
scanf("%lf",&num3);
printf("Your entered integers are %lf and %lf and %lf \n",num1,num2,num3);

if (num1 < num2 && num1< num3 )
printf("%lf",num1);
else if ( num2 < num1 && num2 < num3)
printf("%lf",num2);
else (num3 < num2 && num3 < num1);
printf("%lf",num3);
}

Aucun commentaire:

Enregistrer un commentaire