The for loop

/* Program : The for loop */
    #include <iostream.h>
    void main()
    {
        int i = 0 ;
        cout<<"Table of 15 -\n";

        for (i=1 ; i<=10 ; ++i)
            cout<<"15 * "<<i<<" : "<<15*i;
    }
-----------------------------------
/* Program : The for loop */
    #include <iostream.h>
    void main()
    {
        int i , sum = 0 ;
        for (i=1 ; i<21 ; i++)
            sum = sum + i ;
        cout<<"The sum of first twenty numbers is "<<sum;
    }

--------------------------------------
/* Program: The for loop */
    #include <iostream.h>
    void main()
    {
        int i = 0 ;
        cout<<"Table of 15 -\n";
        for (i=1 ; i<=10 ; i++)
            cout<<"15 * "<<i<<" : "<<15*i;
    }


0 comments:

Post a Comment

 
 
 
 


Copyright © 2012 http://codeprecisely.blogspot.com. All rights reserved |Term of Use and Policies|