• Home
  • Piracy & Policy
  • Disclaimer
  • Terms
  • About
  • Contact Us

Saroj Baniya

  • Home
  • Services
  • Blog
  • Contact
  • About Blog
  • _Terms & Conditions
  • _Piracy & Policy
  • _Disclaimer
  • _Contact
  • _About Us

Write a C Program to Check a Number Odd or Even using Conditional Operator

Saroj July 11, 2022

In this tutorial learn how you can write a c program to check a number odd or even using conditional operator. We are using a test case "<test case>? True value: false value". 

This is the shortcut form of the if statement. First, write a statement and use "?" as a separator then the first one is a true case and else or false case which is separated by ":".

C programming is a powerful general-purpose programming language. It can be used to develop software like operating systems, databases, compilers, etc.


write c program to check number odd or even using conditional operator




Write a Program to Check a Number Odd or Even using Conditional Operator

Here is the code to check a number odd or even using a conditional operator in C programming.

#include <stdio.h> //WAP to check  a number odd or even  using conditional operator.
int main(){
   int num;
    printf("Please enter any number:");
    scanf("%d",&num);
    (num%2==0)?printf("%d is even.",num):printf("%d is odd.",num);
    return 0;
}

Test Live At Jdoodle



Conclusion

This is how you can check a number odd or even using conditional operator in c programming. Comment below if you like our tutorial.

C C Codes C programming Codes Coding How To Tutorial WAP

You may like these posts

0 Comments

Newer Older

Popular Posts

C Programming

3/C%20programming/post-list

Categories

  • Blogger 2
  • C programming 39

Tags

  • add smooth scrolling effect for blogger
  • add table in blogger post
  • Blogger
  • Blogger-Tricks
  • C
  • C Codes
  • C programming
  • Codes
  • Coding
  • How To
  • Tutorial
  • WAP

Search This Blog

Contact Info

I am live on these platform.Thus,you can contact me on the contact below.

Contact List

Facebook: facebook.com/saroj.baniya.3382
Mail: rosesaw20@gmail.com
Phone: +9779818434496

Contact Form

ReCreated By ©Copyright2022 Saroj Baniya
Created By SoraTemplates