P. 1
cprogram7

cprogram7

Ratings: (0)|Views: 33|Likes:
Published by sonirocks

More info:

Published by: sonirocks on Apr 10, 2011
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PPT, PDF, TXT or read online from Scribd
See more
See less

11/24/2011

pdf

text

original

 
1
7. Loops & ControlConstructs
 
R. Subburaj, ³Programming in C´ © Vikas Publshing House Pvt. Ltd, New Delhi2
Loop with ³if´ using goto and labelExample : Demonstrates use of if for iteration#include <stdio.h>int main(){int sum=0, i=1; /*declaration andinitialization combined*/Step3: /*label- loop starts here*/if (i<=10)
Loops
 
R. Subburaj, ³Programming in C´ © Vikas Publshing House Pvt. Ltd, New Delhi3
{sum= sum+i;i=i+1;goto step3;}printf(³sum of first 10 natural numbers=%d\n´,sum);}Result:sum of first 10 natural numbers=55
Loops (Contd.)

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->