# C Programming Code Examples

## C > For Loops and While Loops Code Examples

### find sum of natural numbers from 1 to n

How to using Switch in a C program code -
C programming using switch: The number chosen. Get the choice input. Pick a number between 1 and 20. Check for invalid selection. Selects invalid choice message. Jumps to the

Find Nth Fibonacci Number Use Recursion -
C Program to find the nth 'fibonacci number' using recursion. Program prints the fibonacci of a number. In fibonacci series, each number is the sum of the 2 preceding numbers. 0, 1, 1,

C Armstrong Numbers Between 2 Integers -
Program Print Armstrong Numbers between two Integers. In case of an armstrong number of 3 digits, the Sum of Cubes of each digits is equal to the number itself. For example: 407

C++ Program Code Implement Radix Sort -
In this algorithm Sorting of Data is done from least significant digit to most significant digit. Here we need 10 different spaces labeled 0 to 9. Assume we have "n" Number of inputs. Let

C Language and Vertical Histogram Code -
C program code Vertical Histogram. Define Maximum length of a word. Define Maximum No of words in a sentence. Excluding the space in the word length. Resetting the word

C++ Program Code Print Number Entered -
You'll learn to print the number entered by a user using C++ cout statement. This program asks user to enter a number. When enters an 'integer', it is stored in variable number using

C Calculate the total Revenue and Output -
C Programming Choosing the correct type: long. Calculate quarterly total. Output monthly sales and total for the quarter. Calculate the total revenue and output it.

C++ Program Codes Print Prime Numbers -
For example, to print prime number between '3 to 29', here 3 is the starting number and 29 is the ending number, enter the starting and ending number to find and print all the prime