adsense

Hii, welcome to my site. My name is Om prakash kartik. This blog helps you to learn programming languages concepts.

Write a program in C to find odd or even number without using if else.

Write a program in C to find odd or even number  without using if else.

 #include<stdio.h>  
 #include<conio.h>  
   void main()  
    {  
    int n;  
    clrscr();  
    printf("Enter a number .:-");  
    scanf("%d",&n);  
     switch(n%2)  
    {  
     case 0: printf("%d is even no.",n);  
           break;  
     default:printf("%d is odd no.",n);  
    }   
    getch();  
   }  

Output:-

  


Post a Comment

0 Comments