Write a program using a switch statement to check whether a number given by the user is odd or even
C Programming Language / Decision Making of C Language
6347Program:
#include int main() { int n; printf("\n Enter the number:"); scanf("%d", &n); switch(n%2) { case 0: printf("\n EVEN"); break; case 1: printf("\n ODD"); break; } getch(); return 0; }
Output:
Output 1: Enter the number:12 EVEN Output 2: Enter the number:11 ODD
Explanation:
None
This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.
# C Tutorials
# JAVA Tutorials
# HTML Tutorials
# Computer Fundamental
# Data Structure
# DBMS Tutorials
SQL
# C# Language
# R Language
# PHP
# Python
# Vue JS