Back To C User Defined Functions Index
//program to create two functions that prints the three numbers in ascending order and descending order passed to functions as arguments #include
#include
void asc(int a,int b,int c) { int low,low2,low3; low=a; if(b
big) { big=b; } if(c>big) { big=c; } if(a==big) { if(b>c) { big2=b; big3=c; } else { big2=c; big3=b; } } else if(b==big) { if(a>c) { big2=a; big3=c; } else { big2=c; big3=a; } } else if(c==big) { if(a>b) { big2=a; big3=b; } else { big2=b; big3=a; } } printf("\nprinting the numbers in descending order \n"); printf("%d, %d , %d ",big ,big2 ,big3); } void main() { int a,b,c; clrscr(); printf("\nenter first number "); scanf("%d",&a); printf("\nenter second number "); scanf("%d",&b); printf("\nenter third number "); scanf("%d",&c); asc(a,b,c); desc(a,b,c); getch(); }