Need help getting started with a C application
Hey there, I'd like to firstly say that I don't want anyone to solve the entire question for me, but there is something that has been really bugging me for a while.
Problem: Given the length of four sides determine whether they can be used to create a polygon and determine if that polygon is a square. A polygon can be created if no single side is greater than the sum of the other three sides. Display a ONE when the status (polygon or square) is confirmed and ZERO when the status cannot be confirmed.
It's simple enough, but there is a restriction- we cannot use selection. (logic, if/else, while, that jazz). Without this I'm really confused.
I would say that I can do the code on my own with ease, but I just need help getting started with this problem. How would I go about doing this without selection? I mean everything I think of has some sort of selection in it. (less than, greater than, even those are prohibited)
This is what I have so far:
Code:
//Global Declarations
#include <stdio.h>
//Main function
int main(void)
{
//Variable Declarations
int side1;
int side2;
int side3;
int side4;
//Ask the user for the four sides
printf("Enter the length of the four sides:");
scanf("%d", &side1);
scanf("%d", &side2);
scanf("%d", &side3);
scanf("%d", &side4);
//Print the user input on screen
printf("Length of sides: %d %d %d %d\n",side1,side2,side3,side4);
//Check if valid polygon
return(0);
}
Any help is greatly appreciated.
Thank you.