While statement in c and C++

The simplest of all the looping structures in C is the while statement.we have used while in many of our earlier programs.The basic format of the while statement is
 while(test condition)
 {
           body of the loop
}
The while is an entry-controlled loop statement.The test-condition is evaluated and if the condition is true,then the body of the loop is executed.After execution of the body,the test-condition is once again evaluated and if it is true,the body is executed once again.This process of repeated execution of the body continues until the test-condition finally becomes false and the control is transferred out of the loop.On exit,the program continues with the statement immediately after the body of the loop.
The body of the loop may have one or more statements.The braces are needed only if the body contains two or more statements.However,it is a good practice to use braces even if the body has only one statement.
example:
sum=0;
n=1;
while(n<=10)
 {
 sum=sum+n*n;
n=n+1;
}
printf("sum=%d\n",sum);

7 comments:

  1. Love all that you shared. Your blog is amazing. I learn too much from your blog. Your content is very helpful and informative.
    we also sell best brands Air Conditioners and DC Inverter AC
    Thanks for sharing

    ReplyDelete
  2. good article saves this in your future. I hope that you are doing everything possible to allow yourself and make the future bright.
    Buy Best Abayas in Pakistan

    ReplyDelete
  3. I have read many blogs but this one is very informative. Your content is very informative and helpful, you shared a great blog.
    please write more about Air Conditioner
    Thanks for sharing

    ReplyDelete
  4. Exceptional great uncommon news, I read your article. I like your undertakings concerning this article on this blog. Your substance is striking you depict all that when everything is said in done.
    please write more about Home Appliances
    Thanks for sharing

    ReplyDelete
  5. Great article really inspired form it. The article was also well written. If want to buy devices or appliances like this visit the Best Online Shopping Site. You won't regret it.

    ReplyDelete
  6. its very informative blog thanks for sharing this kind of information. Also check Apple Stock Price

    ReplyDelete

Analysis of Discrete-time Linear-Invariant Systems

we shall demonstrate that such systems are characterized in the time domain simply by their response to a unit sample sequence.we shall als...