Program to Convert even number into its upper nearest odd number Switch Statement

By: Prof. Dr. Fazal Rehman Shamil | Last updated: March 3, 2022

Program to update even number into its upper nearest odd number and similarly convert the odd number into its lower even number using switch statement
Hint1: 4 is even and its nearest upper number is 5
Hint2: 9 is odd and its nearest lower number is 8and similarly convert the odd number into its lower even number using a switch statement
Hint1: 4 is even and its nearest upper number is 5
Hint2: 9 is odd and its nearest lower number is 8

Flowchart of the Program to Convert an even number into an odd number

Flowchart of the Program to Convert an even number into an odd number

C++ Source Code of switch statement program to Convert odd number into its upper nearest even number

Output

Enter a number to be roundoff, to nearest odd or even

2.7

Rounded off to nearest upper odd

3

SFT (Shamil’s Flow Table )

Are you interested to Read about SFT(Shamil’s Flow Table)?

Logic and Explanation of the  even and odd number conversion program 

 

Leave a Reply