C while Loop - learnit

Home Top Ad

Post Top Ad

Saturday, July 24, 2021

C while Loop

C while Loop

Why Should You Learn C Programming?


C enables you to comprehend a computer's internal architecture, as well as how it stores and retrieves data.


Learning other programming languages such as Java, Python, and others will be much easier after learning C.


Possibility of working on open source projects. Some of the most important open-source projects, such as the Linux kernel, Python interpreter, SQLite database, and so on, are written in C.


What is the best way to learn C programming?

C tutorial from Programiz - We offer C tutorials, examples, and references in a step-by-step format. Begin with the letter C.


Official C documentation - Beginners may find it difficult to follow and comprehend. Visit the official documentation for C programming.


Write a lot of C programming code - You can only learn programming by writing a lot of code.


Concerning C Programming

Procedural Language - In a C program, instructions are carried out one by one.

Portable - C programs can be moved from one platform to another and run with no or minimal changes.

Speed - C programming is faster than most other programming languages such as Java, Python, and others.

General Purpose - C programming can be used to create operating systems, embedded systems, and databases, among other things.


C while Loop

With the help of examples, you will learn how to create a while and do...while loop in C programming.

C programming has three types of loops.


for loop

while loop

do...while loop


How does a while loop work?


The while loop evaluates the testExpression contained within the parentheses ().


If testExpression is true, statements within the while loop's body are executed. Then, testExpression is evaluated once more.


The procedure is repeated until testExpression is evaluated as false.


The loop is terminated if testExpression is false (ends).



While Loop

The syntax of the while loop is:

While(testExpression)
{
Instatment
}


Example Code

#include<stdio.h>
#include<conio.h>
int main()
{
int i;
i=1;
while(i<=15)
{
printf("value of i: %i\n",i);
i++;
}
getch();
}


Please Watching My Video is Below

No comments:

Post a Comment

Post Top Ad