Tag Archives: Exercises

Number pattern programs in C

Number pattern is a series of numbers arranged in specific order. These patterns are patterns created by numbers and are similar to star patterns. They are best suited to enhance your logical thinking abilities and to practice flow control statements.

I have assembled a list of number patterns to practice for both novice as well as intermediate programmers. Practice more and more of it, to enhance your logical thinking.

Always feel free to drop down your queries and suggestions below in the comments section. I always love to hear from hugs and bugs from you.

Required knowledge

Basic C programming, Operators, If else, Nested If else, For loop, Nested loop

List of Number pattern programming exercises

Square number patterns

Triangle Easy Number Patterns


Triangle 0,1 Easy Number Patterns


Triangle Hard Number Patterns


Diamond Number Patterns


Tricky Number Patterns


Happy coding 😉

Function, recursion programming exercises and solutions in C

A function is a collection of statements grouped together to do some specific task. In series of learning C programming, we already used many functions unknowingly. Functions such as - printf(), scanf(), sqrt(), pow() or the most important the main() function. Every C program has at least one function i.e. the main() function.

Function provides modularity to our program. Dividing a program in different modules makes it easy to maintain, debug and understand the code.

Continue reading Function, recursion programming exercises and solutions in C

Bitwise operator programming exercises and solutions in C

Data in the memory (RAM) is organized as a sequence of bytes. Each byte is a group of eight consecutive bits. Bitwise operators are useful when we need to perform actions on bits of the data.

C supports six bitwise operators.

  1. Bitwise AND operator &
  2. Bitwise OR operator |
  3. Bitwise XOR operator ^
  4. Bitwise complement operator ~
  5. Bitwise left shift operator <<
  6. Bitwise right shift operator >>

This exercises focuses on mastering bitwise operators. After this exercise you will surely gain some confidence using bitwise operators.

Continue reading Bitwise operator programming exercises and solutions in C

Star patterns in C programming

Star patterns are a series of * or any other character used to create some pattern or any geometrical shape such as - square, triangle(Pyramid), rhombus, heart etc. These patterns are often prescribed by many programming books and are best for practicing flow control statement.

Many programmers around world extremely recommended pattern problems, to enhance logical thinking capabilities. As a novice programmer you must practice these patterns to get a good hands on logical thinking and program flow control.

In this exercise I have compiled a list of Star patterns to practice for beginners and intermediate programmers. I have tried my best to explain the logic of each pattern individually.

If you got stuck with some pattern or have some query or suggestion, always feel free to write it down below in the comments section. I always love to hear from you all.

Required knowledge

Basic C programming, Operators, If else, For loop, Nested loop

List of star pattern programming exercises

Conditional operator programming exercises and solutions in C

Conditional operator is a ternary operator used to evaluate expression based on some condition. Conditional operator is a replacement of small if...else statements. It takes three operand conditional-expression, true-expression and false-expression It is also known as ternary operator, inline if, ternary if etc.

Continue reading Conditional operator programming exercises and solutions in C