Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Spring 2017 Project 2 v1.6
//gcc 5.4.0 #include <stdio.h> //Start Program: //int numOne; //int numTwo; //int numThree; //int v1=0; //int v2=2; //PRINT "Input 3 integers" //READ numOne,numTwo,and numThree //COMPUTE minumum numbers // if(numOne<=numTwo&&numOne<=numThree) // printf("%d is the minimum number",numOne); // else if(numTwo<=numOne&&numTwo<=numThree) // printf("%d is the minimum number",numTwo); // else // printf("%d is the minimum number",numThree); // //COMPUTE maximum numbers // if(numOne>=numTwo&&numOne>=numThree) // printf("%d is the maximum number",numOne); // else if(numTwo>=numOne&&numTwo>=numThree) // printf("%d is the maximum number",numTwo); // // else // printf("%d is the maximum number",numThree); //COMPUTE positive numbers // printf("Positive Numbers:"); // // if(numOne>=v1) // printf("%d,",numOne); // // if(numTwo>=v1) // printf("%d,",numTwo); // // if(numThree>=v1) // printf("%d\n",numThree); // // //COMPUTE negative numbers // printf("Negative Numbers:"); // if(numOne<=v1) // printf("%d,",numOne); // // if(numTwo<=v1) // printf("%d,",numTwo); // // if(numThree<=v1) // printf("%d\n",numThree); //COMPUTE All Even Numbers // printf("Even Numbers:"); // if(numOne%2==v1) // printf("%d,",numOne); // // if(numTwo%v2==v1) // printf("%d,",numTwo); // // if(numThree%v2==v1) // printf("%d\n",numThree); // //COMPUTE All Odd Numbers // printf("Odd Numbers:"); // if(numOne%2!=v1) // printf("%d,",numOne); // // if(numTwo%v2!=v1) // printf("%d,",numTwo); // // if(numThree%v2!=v1) // printf("%d\n",numThree); //COMPUTE All equal numbers // printf("Equal Numbers:"); // if(numOne==numTwo) // printf("%d,%d\n",numOne,numTwo): // else if(numTwo==numThree) // printf("%d,%d\n",numTwo,numThree): // else if(numThree==numOne) // printf("%d,%d\n",numThree,numOne): // else if(numOne==numTwo&&numTwo==numThree) // printf("%d,%d,%d\n",numOne,numTwo,numThree); // else // printf" "); //SORT all numbers //assign integer values to all possible print orders via if then statements //EX if((numOne>numTwo)&&(numOne>numThree)) // if(numTwo>numThree) // x=0; //A=numOne //B=numTwo //C=numThree // //print correct order via switch statement //case 0: // PRINT ABC //BREAK //case 1: //PRINT ACB //BREAK //case 2: //PRINT BAC //BREAK //case 3: //PRINT BCA //BREAK //case 4: //PRINT CAB //BREAK //case 5: //PRINT CBA //BREAK int main(void) { int numOne; int numTwo; int numThree; int v1=0; int v2=2; int x; printf("Input 3 integers\n-----------------\n"); scanf("%d%d%d",&numOne,&numTwo,&numThree); //COMPUTE minumum numbers if(numOne<=numTwo&&numOne<=numThree) printf("%d is the minimum number\n",numOne); else if(numTwo<=numOne&&numTwo<=numThree) printf("%d is the minimum number\n",numTwo); else printf("%d is the minimum number\n",numThree); //COMPUTE maximum numbers if(numOne>=numTwo&&numOne>=numThree) printf("%d is the maximum number\n",numOne); else if(numTwo>=numOne&&numTwo>=numThree) printf("%d is the maximum number\n",numTwo); else printf("%d is the maximum number\n",numThree); //COMPUTE positive numbers printf("Positive Numbers:\n"); if(numOne>=v1&&numOne!=v1) printf("%d\n",numOne); if(numTwo>=v1&&numTwo!=v1) printf("%d\n",numTwo); if(numThree>=v1&&numThree!=v1) printf("%d\n",numThree); //COMPUTE negative numbers printf("Negative Numbers:\n"); if(numOne<=v1&&numOne!=v1) printf("%d\n",numOne); if(numTwo<=v1&&numTwo!=v1) printf("%d\n",numTwo); if(numThree<=v1&&numThree!=v1) printf("%d\n",numThree); //COMPUTE All Even Numbers printf("Even Numbers:\n"); if(numOne%2==v1) printf("%d\n",numOne); if(numTwo%v2==v1) printf("%d\n",numTwo); if(numThree%v2==v1) printf("%d\n",numThree); //COMPUTE All Odd Numbers printf("Odd Numbers:\n"); if(numOne%2!=v1) printf("%d\n",numOne); if(numTwo%v2!=v1) printf("%d\n",numTwo); if(numThree%v2!=v1) printf("%d\n",numThree); //COMPUTE All equal numbers printf("Equal Numbers:\n"); if(numOne==numTwo) printf("%d\n%d\n",numOne,numTwo); else if(numTwo==numThree) printf("%d\n%d\n",numTwo,numThree); else if(numThree==numOne) printf("%d\n%d\n",numThree,numOne); else if(numOne==numTwo&&numTwo==numThree) printf("%d\n%d\n%d\n",numOne,numTwo,numThree); else printf(" \n"); //SORT all numbers printf("Ordered by Value\n"); if((numOne>numTwo)&&(numOne>numThree)){ if(numTwo>numThree) x=0; if(numTwo<numThree) x=1; } if((numOne>numTwo)&&(numOne<numThree)) x=4; // printf("x=%d\n",x); if((numOne<numTwo)&&(numOne>numThree)){ if(numOne>numThree) x=2; if(numOne<numThree) x=3; } // printf("x=%d\n",x); if(numOne<numTwo&&numOne<numThree){ if(numTwo>numThree) x=3; if(numTwo<numThree) x=5; } // printf("x=%d\n",x); if((numOne==numTwo)||(numOne==numThree)||(numTwo==numThree)) { if(((numOne==numTwo)&&(numTwo==numThree))||((numOne>numTwo)&&(numTwo==numThree))) x=0; if(numOne==numThree&&numTwo<numThree) x=1; if(numOne==numThree&&numTwo>numThree) x=2; } // printf("x=%d\n",x); switch(x){ case 0: printf("%d\n%d\n%d\n",numOne,numTwo,numThree); break; case 1: printf("%d\n%d\n%d",numOne,numThree,numTwo); break; case 2: printf("%d\n%d\n%d\n",numTwo,numOne,numThree); break; case 3: printf("%d\n%d\n%d\n",numTwo,numThree,numOne); break; case 4: printf("%d\n%d\n%d\n",numThree,numOne,numTwo); break; case 5: printf("%d\n%d\n%d\n",numThree,numTwo,numOne); break; } }
run
|
edit
|
history
|
help
0
Lior Yehieli Lesson
summing long int
C_141127_MatrizProducto
gets.c
A_141205_Palindromo
project menu
ele709 3.5 finished
A_141205_CadenaValorNumerico
B_141118_Euclides
a