2_1.c |
| #include <stdio.h> #include <stdlib.h> main(){ int lowest; double s1,s2,s3,temp; printf("Please enter a number:\n"); scanf("%lg%lg%lg", &s1,&s2,&s3); lowest=1; temp=s1; if(s2<temp){ lowest=2; temp=s2; } if(s3<temp) lowest=3; if(lowest==1) printf("s1 is the lowest %f\n", (s2+s3)/2); else if(lowest==2) printf("s2 is the lowest %f\n",(s1+s3)/2); else printf("s3 is the lowest %f\n",(s1+s2)/2); return 0; } |
James Little |