# C Programming Code Examples

## C > Mathematics Code Examples

### C Program to Check Whether a Number is Prime or Not

Code find first & last digit of any number -
C program to input a number from user and find first and last digit of number using loop. Before I explain logic to find first digit, let us first learn to find last digit of a number. Find

C Program code to Print Number in words -
C program to input a number from user and print it into words using for loop. The above logic is correct however it print the words in reverse order. For example, suppose number

C Display the Characters in Prime Position -
Take a string as input and store it in the array str[]. "Store the Length" of the input string in the variable 'k'. Use "two Loops" to divide the numbers "upto the value" of k. Increment the

Every Possible Combination of two Strings -
Program display 'every possible combination' of two words from the given 2 string without displaying "repeated combinations". Convert string in 2D array. Make the first string words

C Find Prime Numbers Between the Range -
The program takes the range and finds all the 'Prime Numbers' between the range & prints. Lets first take the range of numbers between which you have to find the prime numbers as

Check Whether Number is Strong Number -
How to check Strong Numbers using loop in C. What is Strong number? Strong number is a special number whose sum of factorial of digits is equal to the original number. 145 is

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

C code swap First & Last digit of a number -
C Program to input a Number from user and swap first and last digit of the given number. First input a number from user and find last digit. Total number of digit - 1. Find first digit.