For Loop in C programming with examples

For loop in C programming is a statement to repeat the set of statements until a condition to be satisfied. Syntax of for loop statement: for(initialization; conditionCheck; updation ) { statement 1; statement 2; ————– } “for-statement” has a initialization , condition and iteration (increment/ decrement) part separated by semicolon. Initialization : This phase allows … Read more

Do While Statement in C Programming

like a while statement,  “ do while statement” repeats a set of statements if condition is true. If condition is false the flow of control do not enter inside the do-while loop. “do-while” first execute the body of loop than tests the condition. Means even if the condition if false do-while executes at least ones. … Read more

While Statement in C Programming

“while loop” repeats a set of statements if condition is true. If condition is false the flow of control do not enter inside of while loop. It first tests the condition then execute the body of loop. Syntax of a while statement−

Example: Write a program to print 1 to 10 using while loop.

Read more

Switch Case in C Programming

“switch case ” is a case control structure.  It contains case and default values. “switch” statement takes a value as a expression for equality testing against a list of values/case. Switch case statement is used in programming to select one amont multiple options. syntax for a switch statement:-

Rules of switch statement − In a “switch” statement we can … Read more

Assignment Operators in C Programming

In a C language there are following assignment operators  − Operator Description Example = assignment operator (it assigns values of right side operands to left side operand ) a=5 += Add assignment operator a+=5 -= Subtract assignment operator a-=5 *= Multiply  assignment operator a*=5 /= Divide assignment operator a/=5 %= Modulus assignment operator a%=5 <<= … Read more

Bitwise Operators in C Programming

In a C programming language Bitwise operator works on bits and perform bit-by-bit operation. There are following bitwise operators in C:- Operator Description Example & Binary AND Operator   a & b | Binary OR Operator a| b ^ Binary XOR Operator  a^b ~ Binary One’s Complement Operator is unary ~a <<  Binary Left Shift … Read more

Logical Operators in C Programming

There are three logical operators in C language. Assume variable A and B holds 1 and 0 respectively then – Operator Description Example &&  AND operator (the condition becomes true if both the operands are non-zero) (A && B) is false. ||  OR Operator (the condition becomes true if any of the two operands is non-zero) (A … Read more

Relational Operators in C Programming

C Language has a following relational operators. For example: Assume variable A holds 100 and variable B holds 200 then − Operator Description Example == Equals to (A == B) is not true. != Not equal (A != B) is true. >  Greater than (A > B) is not true. <  Less than (A < B) is true. >= … Read more

Arithmetic Operators in C Programming

C language have a following arithmetic operators. Assume variable i holds 100 and variable j holds 200 then – Operator Description Example + Adds two operands. i + j = 300 − Subtracts second operand from the first. i − j = -100 * Multiplies two operands. i * j = 20000 / Divide. j / i = 2 … Read more