# C Programming Code Examples

## C > If Else and Switch Case Code Examples

### Nested if...else statement (if...elseif....else Statement)

```
```

```
```

Swapping Two Numbers Without Variable - Imagine we have two number 1 and 2 stored in x and j respectively now. If we add x and j (1 + 2) and store it to x then x will become 3 and j is still 2. We subtract j (2) from new value of

Check Vowel or Consonant use switch case - English Alphabets a, e, i, o, u both lowercase & uppercase are known as vowels. Alphabets other than Vowels are known as Consonants. Input an alphabet from user. Store it in some

Code Prints Fibonacci Series upto n Terms - C Programming print Fibonacci series up to n terms using loop. Fibonacci series is a series of numbers where the current number is the sum of previous two terms. For Example: 0, 1,

Multiline Comments in C++ programming - To write a "Multiline Comment" you have to write "/*" at the start of the Comment. After this you can write as many number of lines of description. When you are done with writing

Writing Data into a Text File C++ program - A 'while loop' is used and will terminate when user will press esc key. To get the characters a function 'getche()' is used from conio.h which will store in 'char variable' & store into the file

Program to Find Minimum Spanning Tree - This C++ program sample depicts the Prim's Algorithm which finds the minimal spanning tree(tree consisting of the minimum weights of edges connecting any 2 vertices) in graph.

Find Twos Complement of Binary Number - C program code to input binary number from user and find twos complement of the binary number. Twos complement of N-bit number is defined as the complement with respect to