Before seeing the solution make sure that you tried enough. Don’t paste the whole code, just find out the logic. If you stuck in trouble, just inform me on comment.
/**Bismillahir Rahmanir Rahim.**/ #include <stdio.h> int main() { int A,B,C; scanf ("%d%d%d", &A,&B,&C); if(A<B&&A<C) { if(B<C) printf("%d\n%d\n%d\n",A,B,C); else printf("%d\n%d\n%d\n",A,C,B); } if(B<A&&B<C) { if(A<C) printf("%d\n%d\n%d\n",B,A,C); else printf("%d\n%d\n%d\n",B,C,A); } if(C<B&&C<A) { if(B<A) printf("%d\n%d\n%d\n",C,B,A); else printf("%d\n%d\n%d\n",C,A,B); } printf ("\n%d\n%d\n%d\n",A,B,C); return 0; }
what if all the values are equal? Ex: 5 , 5 , 5
ReplyDeletethen print only 5 5 5
DeleteBecause of that, the code above is wrong
ReplyDelete