Thursday, 26 December 2013

For, While, Do While Loop concepts

     int  i=0;
  

  

char j[]="Ganesh kodi krishna manoj vinoth sivaram manohar";
int n=strlen(j);



    for (i=0;i<n;i++)

            {

        lr_output_message("My name is %c:",j[i]);
      
      
      
    if (j[i]==' ')
        {
            lr_output_message("\t");
        }
    }
------------- >>>>>>>>>>> ***************** <<<<<<<<<<<<<<-----------------------
    i=0;

    while(i<n)
    {
        lr_output_message("My name is %c:",j[i]);
      
      
          
    if (j[i]==' ')
        {
            lr_output_message("\n");
        }
    i++;
    }

------------- >>>>>>>>>>> ***************** <<<<<<<<<<<<<<-----------------------
  
    i=0;
      
    do
    {
        lr_output_message("Myname is %c:",j[i]);
        i++;

    }
    while(i<n);

No comments:

Post a Comment