Tag Archives: C-Language

What is math.h and why do we use?

math.h is a header file in the C Standard Library, which is commonly used in C programming. It is designed for basic mathematical operations. This header file defines a set of functions and macros that provide mathematical functions capabilities for C programs. Some of the most commonly used functions in math.h are sqrt, log, sin, cos, tan, exp,… Read More »

Nested Loop in C

Prerequisite – Loops in C A nested loop is a loop inside another loop. In C programming language, you can nest a loop inside another loop to perform repetitive tasks. The inner loop executes its entire cycle each time the outer loop executes one cycle. Here is an example of a nested loop in C that prints a… Read More »

Loops in C

Loops are a fundamental control structure in programming that allow a section of code to be executed repeatedly. In the C programming language, there are three types of loops: the for loop, the while loop, and the do-while loop. 1. for loop: The for loop is used to execute a block of code a specific number of times.… Read More »

Goto Statement in C

Prerequisite – Control Statements in C The goto statement in C allows you to jump to a different point in the program’s code. It’s often considered to be a controversial feature of the language, as it can lead to unreadable and difficult-to-debug code. Syntax: The basic syntax of the goto statement in C is as follows: Here, label… Read More »

Continue Statement in C

Prerequisite – Control Statements in C In C, the “continue” statement is used to skip the current iteration of a loop and move on to the next one. Here are a couple of examples of using “continue” in different loops: Example-1: Print odd numbers between 1 and 10 using a “for” loop and “continue” Output: 1 3 5… Read More »

Switch Statement in C

Prerequisite – Control Statements in C The “switch” statement in C is a conditional statement that allows you to test the value of a variable against a list of possible values. It can be a useful alternative to a series of “if-else” statements when you have multiple conditions to test. Syntax: The basic syntax of a “switch” statement… Read More »

Do-While loop in C

Prerequisite – Control Statements in C The “do-while” loop is a loop statement in C that executes a block of code at least once, and then continues to execute the code as long as the loop condition is true. Syntax: The basic syntax of a “do-while” loop in C is: Here, the code block within the “do” statement… Read More »

While loop in C

Prerequisite – Control Statements in C In C, a “while” loop is a control structure used for repeating a set of statements as long as a certain condition is true. It is often used when the number of iterations is not known in advance, or when the number of iterations depends on the input data. Syntax: The syntax… Read More »