IHYPRESS.NET
C
HOME | ASP | C | CSS | HTML | JAVASCRIPT | PERL | PHP | PYTHON | RUBY | SVG
CSelection Structures ❯ Simple if Statement
<03.01>
/* A simple if statement */ #include <stdio.h> #define THRESHOLD 20 int main (void) { int temp; printf ("What is the current temperature? "); scanf ("%d", &temp); printf ("------------------------------------\n"); //this if statement contains a true and a false branch //with a compound statement in each branch if (temp >= THRESHOLD) { printf ("The temperature is %d degrees. \n", temp); printf ("It is quite warm. \n"); } else { printf ("The temperature is %d degrees. \n", temp); printf ("It is quite cool. \n"); } return (0); }
Hergestellt in Deutschland / Made in Germany
What is the current temperature? 13 ------------------------------------ The temperature is 13 degrees. It is quite cool.
COPYRIGHT © 2015-2024 IHYPRESS.NET. A DIVISION OF IHY PRESS. ALL RIGHTS RESERVED.