hi
this is my 1st post here, hope i'll get know learn many things.
I am just starting an introductory course on C programming in ANSI in my university.
the other day my sir gave me an assignment telling us to prompt the user for 3 integers and the output should give them in ascending order.
I tried my best....and this is how it looks.
Code:
#include <stdio.h>
#include <conio.h>
int a,b,c;
void main (){
printf("Please enter 3 integers\n");
scanf("%d %d %d", &a,&b,&c);
printf("The integers from smallest to largest are:\n");
if (a>b) {
if (b<c){
printf("%d %d %d", a,b,c);
}
else if (a<c){
printf("%d %d %d", a,c,b);
}
else {
printf("%d %d %d", c,a,b);
}
else{
if (b>c){
printf("%d %d %d", c,b,a);
}
else if (b<c){
printf("%d %d %d", b,c,a);
}
else {
printf("%d %d %d", b,a,c);
}
}
}
}
can some one please find me the flaw??? it doesnt run
Hobilla.. Thanks