Javatpoint Logo
Javatpoint Logo

R while loop

A while loop is a type of control flow statements which is used to iterate a block of code several numbers of times. The while loop terminates when the value of the Boolean expression will be false.

In while loop, firstly the condition will be checked and then after the body of the statement will execute. In this statement, the condition will be checked n+1 time, rather than n times.

The basic syntax of while loop is as follows:

Flowchart

R While Loop

Example 1:

Output

R While Loop

Example 2: Program to find the sum of the digits of the number.

Output

R While Loop

Example 3: Program to check a number is palindrome or not.

Output

R While Loop

Example 4: Program to check a number is Armstrong or not.

Output

R While Loop

Example 5: program to find the frequency of a digit in the number.

Output

R While Loop
Next TopicR Functions





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA