IHYPRESS PROGRAMMING
Tutorials and C programs with code and output for beginners
c programming
HOME | ASP | C | CSS | GNUPLOT | 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 IHY PRESS Frankfurt am Main 60329 Deutschland