Tuesday 31 December 2013

C++ Program prints the number 10 ten times Using static variable

#include<iostream.h>
void function()
{
static int k=10;
 cout<<k<<endl ;
 k++;
}
void main()
{
      clrscr();
     int i=10;
     for(i=0;i<10;i++)
     {
       function();
     }
}

No comments:

Post a Comment