Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

While Loop

The while loop is ideally suited for case in programming that you want to do something
a fixed number of times.
Sample Program
/* Calculation of simple interest for 3 sets of p, n and r */
main( )
{
int p, n, count ;
float r, si ;
count = 1 ;
while ( count {
printf ( "\nEnter values of p, n and r " ) ;
scanf ( "%d %d %f", &p, &n, &r ) ;
si = p *n*r/100;
printf ( "Simple interest = Rs. %f", si ) ;
count = count +1;
}
}

The program executes all statements after while 3 times.


This post first appeared on INFORMATION TECHNOLOGY, please read the originial post: here

Share the post

While Loop

×

Subscribe to Information Technology

Get updates delivered right to your inbox!

Thank you for your subscription

×