New Update Launched Contact Us Download Now!

Algorithm and flowchart to check whether a number is odd or even using ternary operator in C with source code

Please wait 0 seconds...
Scroll Down and click on Go to Link for destination
Congrats! Link is Generated

THEORY

The stdio.h denotes the C library that we have connected this program to, which contains the code to execute the printf command and display results. The printf keyword is used to display content on the screen. It can be used to display strings, numbers as well as values of variables, etc. The scanf command is used to read user input and is used to accept the value of the circle radius from the user. A condion is used to check whether the number is larger or not. The condition operator used here is the ternary operator.
Its syntax is: (condition)?true statement:false statement;

Algorithm and flowchart to check whether a number is odd or even  using if else statement in C with source code

FLOWCHART
flowchart to check whether a number is odd or even  using if else statement in C

Algorithm

Step 1: Start
Step 2: Read a
Step 3: If a%2=0 then follow step 4 else step 5
Step 4: Print a is even
Step 5: Print a is odd
Step 6: Stop
C Source Code

//Written By DataVoid Team
#include<stdio.h>
 void main()
 { 
   int a;
   printf("\n Enter a number:");  
   scanf("%d",a);
   (a%2=0)?printf("\n The number is even"):printf("\n The number is odd");
 }

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.