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

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
#include<iostream> #include<conio.h> using namespace std; int main() { int number,choice; cout<<"Enter a number to be roundoff, to nearest odd or even"<<endl; cin>>number; switch(number%2==0) { case 1: cout<<"Rounded off to nearest upper odd"<<endl; cout<<number+1; break; case 0: cout<<"Rounded off to nearest lower even"<<endl; cout<<number-1; break; } } |

**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)?