Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » BeginnersRSS Feeds

Program to find even or odd number using switch case

Posted By: Abelardo Fischer     Category: C Programming     Views: 24914

Write a program to find even or odd number using switch case.

Code for Program to find even or odd number using switch case in C Programming

#include <stdio.h>
main()
{
int i,n;  //the
scanf("%d",&n); for(i = 1; i<n; i= i+1)
{
switch(i%2) // statement A

{
case 0 : printf("the number %d is even \n",i); // statement Bbreak;   // statement Ccase 1 : printf("the number %d is odd \n",i);
            break;
}

}

}
  
Share: 


Didn't find what you were looking for? Find more on Program to find even or odd number using switch case Or get search suggestion and latest updates.

Abelardo Fischer
Abelardo Fischer author of Program to find even or odd number using switch case is from Frankfurt, Germany.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!