Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Spring 2017 Project 2 v.05
//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 int main(void) { int numOne; int numTwo; int numThree; int v1=0; int v2=2; 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) printf("%d\n",numOne); if(numTwo>=v1) printf("%d\n",numTwo); if(numThree>=v1) printf("%d\n",numThree); //COMPUTE negative numbers printf("Negative Numbers:\n"); if(numOne<=v1) printf("%d\n",numOne); if(numTwo<=v1) printf("%d\n",numTwo); if(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(" "); //SORT all numbers }
run
|
edit
|
history
|
help
0
a1
variable arguments 2
example of scanf and basic integer manipulation
150112_CribaErastotenes
B_141121_fibonacci
A_141211_FuncionesVarias
888 BONUS LAB 1
bitwise operations
14th Feb Project v0.3
AVANCE 1 TAREA M4 - PERLAS