Tech Getz

Main Menu

  • Mobile
  • Apple
  • Computer
  • Contact Us
Sign in / Join

Login

Welcome! Login in to your account
Lost your password?

Lost Password

Back to login

logo

  • Mobile
    • Oneplus 9 pro launching on March 23

      03/10/2021
      0
    • JIO starts 5G service in India next year:Mukesh Ambani

      12/08/2020
      0
    • Xiaomi Mi 10 pro launched with 5G

      03/29/2020
      0
    • Redmi Note 9 Pro launched Rs 14999

      03/12/2020
      0
    • RealMe 6 pro launch in India on March 5

      02/26/2020
      0
    • Vivo S1 Pro Review

      01/27/2020
      0
    • Why Android Studio for App development?

      01/23/2020
      0
    • samsung Galaxy A50 specification and review

      12/28/2019
      0
    • How to stop adding someone to Whatsapp Group

      12/24/2019
      0
  • Apple
    • The story of Jobs and Ipod

      11/16/2020
      0
    • Jobs firing and return to Apple Inc

      10/09/2019
      0
    • Apple iPad 2018 Vs iPad 2017

      03/29/2018
      0
  • Computer
    • JIO starts 5G service in India next year:Mukesh Ambani

      12/08/2020
      0
    • How to enable WhatsApp 'Disappearing Messages' feature

      11/19/2020
      0
    • What is data Analyst and Scope?

      11/08/2020
      0
    • What is for Looping in C?

      09/29/2020
      0
    • Which is the first program language from Bill Gates

      09/20/2020
      0
    • Tiktok rival launched by Youtube

      09/16/2020
      0
    • Which is the first video Conferencing App In the World

      08/23/2020
      0
    • What are the Retan Tata's Investments in Startups

      08/13/2020
      0
    • What are Chinese Social Media Applications

      07/14/2020
      0
  • Contact Us
Computer
Home›Computer›How the Loop statement works in C language

How the Loop statement works in C language

By fazilmuhammed
05/18/2020
725
0
Share:

The looping statement is used for code to be run several times. The loop statement is exit when condition is over.A loop becomes an infinite loop if a condition never becomes false.

What are the Step to using loop statement

Step 1:Firstly to initialization happens and the counter variable gets initialized.
Step 2:The Second step the condition for checking, where the counter variable is tested for the given condition, if the condition returns true then the  statements inside the body of  loop gets executed, if the condition returns false then the  loop gets exit and the control comes out of the loop.

Step 3: The successful execution of statements inside the body of loop, the counter variable is incremented or decremented, depending on the operation (++ or –).

Flow chart of For loop

Flow chart of For loop

What are the types of Loop are used

  • while loopRepeats a statement or group of statements while a given condition is true. It tests the condition before executing the loop body.
  • do…while loopIt is more like a while statement, except that it tests the condition at the end of the loop body.
  • for loop

    Most commonly used loop statement.Executes a sequence of statements multiple times and abbreviates the code that manages the loop variable.

  • nested loops

    You can use one or more loops inside any other while, for, or do..while loop

while loop

The while loop allows a part of the code to be executed multiple times  upon a given boolean condition. It can be viewed as a repeating if statement. The while loop is mostly used in the case where the number of iterations is not known in advance.

Syntax

while (condition test)
{
      //Statements to be executed repeatedly 
      // Increment (++) or Decrement (--) Operation
}
  • The while loop evaluates the test expression inside the brackets().
  • If the test expression is true, statements inside the body of while loop are executed. Then, the test expression is evaluated again.
  • The process goes on until the test expression is evaluated to false.
  • If the test expression is false, the loop terminates (ends).

do…while loop

The do..while loop is similar to the while loop with one important difference. The body of do…while loop is executed at least once. Only then, the test expression is evaluated.

The syntax of the do…while loop is:

do

{

// statements inside the body of the loop

}

while (testExpression);

  • The body of do…while loop is executed once. Only then, the test expression is evaluated.
  • If the test expression is true, the body of the loop is executed again and the test expression is evaluated.
  • This process goes on until the test expression becomes false.
  • If the test expression is false, the loop ends.

for Loop

The syntax of the for loop is:

for (initializationStatement; testExpression; updateStatement)
{
    // statements inside the body of loop
}

  • The initialization statement will execute only once.
  • Then, to test expression is evaluated. If the test expression is evaluated to false, the for loop is terminated.
  • However, if the test expression is evaluated to true, statements inside the body of for loop are executed, and the update expression is updated.
  • Again the test expression is evaluated.This process goes on until the test expression is false. When the test expression is false, the loop terminates.
Previous Article

The Unacademy success story.

Next Article

Facebook announce new area facebook shop

0
Shares
  • 0
  • +
  • 0
  • 0
  • 0
  • 0

Related articles More from author

  • Computer

    Which is the first program language from Bill Gates

    09/20/2020
    By fazilmuhammed
  • Computer

    Microsoft Surface Pro 6 spec

    01/28/2019
    By fazilmuhammed
  • BusinessComputer

    What the details about Zoom Video Communication and founder Eric Yuan.

    04/20/2020
    By fazilmuhammed
  • Computer

    Delete Facebook and forget about it, says WhatsApp co-founder Brian Acton

    03/21/2018
    By fazilmuhammed
  • ComputerMobile

    JIO starts 5G service in India next year:Mukesh Ambani

    12/08/2020
    By fazilmuhammed
  • Computer

    LET US STUDY C PROGRAMMING 2 Variables,keywords

    04/20/2020
    By fazilmuhammed

Leave a reply Cancel reply

  • Computer

    Mark Zuckerberg stage at Facebook F8

  • Business

    New Google Home Review

  • Tech Getz

    Top 10 brands of liquour

  • Recent

  • Popular

  • Comments

  • Oneplus 9 pro launching on March 23

    By fazilmuhammed
    03/10/2021
  • JIO starts 5G service in India next year:Mukesh Ambani

    By fazilmuhammed
    12/08/2020
  • How to enable WhatsApp ‘Disappearing Messages’ feature

    By fazilmuhammed
    11/19/2020
  • The story of Jobs and Ipod

    By fazilmuhammed
    11/16/2020
  • What is data Analyst and Scope?

    By fazilmuhammed
    11/08/2020
  • Oneplus 9 pro launching on March 23

    By fazilmuhammed
    03/10/2021
  • WHAT IS BELUGA CAVIAR

    By fazilmuhammed
    07/23/2017
  • BEST SELLING AUTOMOBILES

    By fazilmuhammed
    07/23/2017
  • Rare Stories About Dr. APJ Abdul Kalam

    By fazilmuhammed
    07/26/2017
  • Is it coffee help you live longer?

    By fazilmuhammed
    08/02/2017

Tech News

  • MobileTechnology

    Oneplus 9 pro launching on March 23

    The waiting is over for Oneplus 9 pro, the phone will be launching on March 23. The main feature of the phone camera is provided by Hasselbad. The Hasselbad is ...
  • ComputerMobile

    JIO starts 5G service in India next year:Mukesh Ambani

    Jio 5G service will be launch may be in June 2021 said Mukesh Ambani during his keynote at India Mobile Congress 2020.Jio developing affordable android phone. The collaboration with Google ...
  • Computer

    How to enable WhatsApp ‘Disappearing Messages’ feature

    In the new updation of Whatsapp introduced new feature is disappearing message feature. This feature is once enabled, new messages sent in the individual or group chat will disappear after ...
  • Apple

    The story of Jobs and Ipod

    Ipod is the Apple’s one of the creative productive. In the 1990s walkman is the portable music player, but it is bulky. In the time Steve Jobs things 1000 music ...
  • Computer

    What is data Analyst and Scope?

    The data analyst can do the transforming data into information. This will improve knowledge and business. Now data analysis plays a role in making decisions more scientific and helping businesses ...

About Us

Contact Us


  • +919995217791
  • techyget@gmail.com
  • Recent

  • Popular

  • Comments

  • Oneplus 9 pro launching on March 23

    By fazilmuhammed
    03/10/2021
  • JIO starts 5G service in India next year:Mukesh Ambani

    By fazilmuhammed
    12/08/2020
  • How to enable WhatsApp ‘Disappearing Messages’ feature

    By fazilmuhammed
    11/19/2020
  • The story of Jobs and Ipod

    By fazilmuhammed
    11/16/2020
  • Oneplus 9 pro launching on March 23

    By fazilmuhammed
    03/10/2021
  • WHAT IS BELUGA CAVIAR

    By fazilmuhammed
    07/23/2017
  • BEST SELLING AUTOMOBILES

    By fazilmuhammed
    07/23/2017
  • Rare Stories About Dr. APJ Abdul Kalam

    By fazilmuhammed
    07/26/2017

Follow us

© Copyright TECHGETZ. All rights reserved.