Tag Archives: Loop

C program to print hollow square star pattern with diagonal

Write a C program to print hollow square star pattern with diagonal using loops. How to print hollow square star pattern with diagonals in C program. Logic to print hollow square star pattern with diagonal in C programming.

Example
Input

Enter number of rows: 5

Output

Continue reading C program to print hollow square star pattern with diagonal

Infinite loops in C – Use and Debugging

Infinite loop is a looping construct that iterates forever. In programming life either intentionally or unintentionally, you come across an infinite loop. Generally a program in an infinite loop either produces continuous output or does nothing. Infinite loops are also known as indefinite or endless loop.

As a novice programmer, you must know how to debug an infinite loop. As an intermediate programmer you must know how and when to use infinite loop. Let us first learn when to use infinite loop and how to define.

Continue reading Infinite loops in C – Use and Debugging

Do…while loop in C programming

C programming supports three types of looping statements for loop, while loop and do...while loop. Among three do...while loop is most distinct loop compared to others.

do...while is an exit controlled looping statement. We use do...while loop when there is a need to check condition after execution of loop body. do...while loop in any case executes minimum once.

Continue reading Do…while loop in C programming

For loop in C programming

In real life we come across situations when we need to perform a set of task repeatedly till some condition is met. Such as – sending email to all employees, deleting all files, printing 1000 pages of a document. All of these tasks are performed in loop. To do such task C supports looping control statements.

For loop is an entry controlled looping statement. It is used to repeat set of statements until some condition is met.

Continue reading For loop in C programming

Half diamond number pattern with star border program in C – 1

Write a C program to print the given half diamond star number pattern series using for loop. How to print the given half diamond star number pattern series using loop in C programming. Logic to print the given star number pattern series using for loop.

Continue reading Half diamond number pattern with star border program in C – 1

Half diamond number pattern program in C – 3

Write a C program to print the given half diamond number pattern series using loop. How to print the given number pattern series using for loop in C programming. Logic to print the given half diamond number pattern series using for loop.

Continue reading Half diamond number pattern program in C – 3