Skip to main content

Understand While Loop in C Language

While loop

It is often the case in programming that you want to repeat something a fixed number of time. Perhaps you want to calculate gross series of ten different persons, or you want to convert temperatures from centigrade to Fahrenheit for 15 different cities. The while loop is ideally suited for this.


 General form of WHILE LOOP statement:


Note the following points about WHILE…..

Ø  The statement within the while loop will keep getting executed till the condition being tested remain true. When the condition become false, the control passes to the first statement that flows the body of the WHILE LOOP.

Ø  In place of the condition, there can be any other valid expression. So long as the expression evaluates to a non-zero value, the statements within the loop would get executed.

Ø  The condition being tested may use relational or logical operators as show in above example: while(i<=10)

while(i>=10&&j<=15)

while(i>10&&(b<15||c<20))

Ø  The statement within the loop may consist a single line or a block of statement. In the first case, the braces are optional.

Ø  Almost always, the while must test a condition that will eventually become false, otherwise the loop would keep getting executed forever, indefinitely.

Ø  Instead of incrementing a loop counter, we can decrement it and still manage to get the body of the loop executed repeatedly.

Ø  It is not necessary that a loop counter must only be an int. it can even be a float.

Ø  Even floating point counters can be decremented. Once again the increment and decrement could be any value, not necessarily 1. 

 

Comments

Popular posts from this blog

How to Attract People By Search Engine Marketing

How to Attract People By Search Engine Marketing: Any business that can come online must come online !! But it is not that you have created your website and people will just start coming to it. Search engine is the best way to call people to your website. Now the search engine is also many, whose user in India is something like this. Google 97.65% Bing 1.39% Yahoo 0.89% DuckDuckGO 0.03% (According to IndianMarketer) Everyone knows that Google is the most famous search engine, There are two ways to get traffic or logo from Google Search engine optamization (SEO) Search engine marketing (SEM) What is SEARCH ENGINE MARKETING? Search engine marketing or SEM is the best way to rank on Google in any category. Nowadays everyone wants to increase your bussiness, in such a situation where big companies have made their place on the first page of Google, the same SEM gives us the chance that we too can spend above money by coming to those websites. When we come above SEM, it is called inorgan...

How To Know Best Tools For Social Media Marketing Part 2

  Best Tools For Social Media Marketing Part 2 Today we will tell you about social media marketing tools Part 2. in this article remaining 6 tools, which are helping in a social media campaign. Unsplash: - It is very important to have amazing images while having high-quality textual content. Unsplash provides a database of high-resolution, great images that you can use with your posts, the fact that a good image has its own unique significance cannot be denied. Each image is properly tagged so that you can find the most appropriate image for your post. Marin: - If your agency runs a social media advertising campaign (campaign), then this social media management tool will be useful for you. Marin offers a range of features that promise to increase your ROI by up to 30% compared to native equipment. One of its cool features is called auto-split which helps your audience in the micro-segment. Nimble: - As your customer list grows, a powerful CRM is needed to automate data manag...

How to create SEARCH ENGINE MARKETING AD

 How to create SEARCH ENGINE MARKETING AD: Before creating a search engine marketing ad, select the keyword on which to create the ad and modify your landing page keeping in mind the good keyword.  To make AD To create SEM AD, first, go to Google adwords Click on the campaign inside the dashboard and click on + Sign to create a new campaign and select a new campaign. Click on search in campaign type You will get 3 option Sale - To sell a product or service. To get some action from Lead - Customer. Website Traffic - To send a logo to your website. If you want to send traffic to the website, then click on website traffic. Add a link to your website. Setting up your CAMPAIGN. Network Selection - In this, you have to show the Ad's ad on Google, or on the partner website that is with it. Location - Select the location of your target audience. Language - Select the language of the customer. Budget - Enter your daily budget. Whatever you are willing to spend every day. Delivery metho...