Files
2023-02-24 03:55:27 +00:00

35 lines
961 B
C

/*
Nicholas Pease
HW5A - Space Shuttle Esque Calculations
*/
#include <stdio.h>
int main() {
// instantiate input vars
// int xNum: stores integer input
// input section
int firstNum, secondNum, thirdNum;
printf("Enter first number: ");
scanf(" %d",&firstNum);
printf("Enter second number: ");
scanf(" %d",&secondNum);
printf("Enter third number: ");
scanf(" %d",&thirdNum);
// end input section
// start output
/// prints Value: then tests to see which set (if any) match
printf("Value: ");
if (firstNum == secondNum || secondNum == thirdNum || thirdNum == firstNum) {
// if one of the sets match (1&2, 2&3, or 3&1), test to see which number to output using nested conditional operators
printf("%d\n",firstNum == secondNum? firstNum: secondNum == thirdNum? secondNum: thirdNum);
} else {
// if none match, print ERROR
printf("ERROR\n");
}
return 0;
}