# C Programming Code Examples

## C > For Loops and While Loops Code Examples

### Write a C program to input number from user and check number is palindrome or not using loop.

C Program Prints All Odd Numbers 1 to N -
How to print Odd Numbers from 1 to N using loop in C programming. Input upper limit to print odd number from user. Store it in some variable N. Run a loop from 1 to N, increment

C Add Two Distances (in inch-feet) System -
In this c program code, a structure Distance is defined. The structure has two members inch (a float) and feet (an integer). Two variables (distance1 and distance2) are created which...

Demonstrates Printf Inside Another Printf -
Firstly Inner printf is executed which results in printing 1324. Printf returns 'Total Number' of Digits:4 & second inner printf will looks like. It prints 4 & Returns the Total Number of digits

Find sum of Even Numbers in given Range -
Input upper limit to find sum of even number. Store it in a variable say N. Initialize another variable to store sum with 0 say sum = 0. To find sum of even numbers we need to iterate

C++ Binary Addition & Binary Subtraction -
Addition, Subtraction, Multiplation, Result to decimal. Reverse second binary operand and Creating an array for addition. Addition of all columns without carry. Final calculations and

C Language Codes & Arithmetic Operators -
Arithmetic operator performs mathematical operations such as addition, subtraction and multiplication on numerical values (constants and variables). C Program to demonstrate...

C Program Inputs two Strings & Compares -
Lets take 2 Strings as input and store them in the arrays string1[] and string2[] respectively. "Count the Number" of characters in both the arrays and store the result in the variables co1

C Sum of the Main and Opposite Diagonal -
C Program code finds the sum of the main & opposite diagonal elements of a MxN Matrix. The program accepts an MxN matrix. Then adds main diagonal of matrix as well as the