C: Ternary operator demonstration.
Demonstrating how a ternary statement works in C. https://github.com/pereiradaniel/c_programs/blob/master/ternary/ternary.c #include <stdio.h> int main(int argc, char* argv[]) { int n = -1; // Set to -1 for do while loop. printf("\nEnter number from 0-100: \n"); // prompt user for input. // Loops until user enters valid input: do { scanf(" %d", &n); n < 0 || n > 100 ? printf("Invalid number! Try again.\n") : printf("Valid!\n"); } while(n < 0 || n > 100); // Detect whether number is less than or greater than 50: n > 50 ? printf("Number is greater than 50.\n") : printf("Number is less than 50.\n"); return 0; } https://github.com/pereiradaniel/c_programs/blob/master/ternary/ternary.txt ==119== Memcheck, a memory error detector ==119== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==119== Using Valgrind-3.15.0 and LibVEX;...