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 : Even vs. Odd Numbers
<03.04>
/* Even vs. Odd */
#include <stdio.h> int main (void) { int number, even; /* ask user for number */ printf ("Enter an integer number: "); scanf ("%d", &number); /* determine if number is even and put in variable */ even = (number % 2 == 0); /* display report */ if (even) printf ("%d is an even number.\n", number); else printf ("%d is an odd number. \n", number); return (0); }
Hergestellt in Deutschland / Made in Germany
Enter an integer number: 56 56 is an even number.
COPYRIGHT © 2015-2024 IHY PRESS Frankfurt am Main 60329 Deutschland