While and do while loop C

 int main()

{


    int x = 1;

    while (x <= 10)

      {

    printf("%d\n", x);

    x = x + 1;

      }



    return 0;

}

-------------------------------------

 int main()

{


    int x = 1;

    while (x <= 10)

      {

    printf("%d\n", x);

    x++;

      }



    return 0;

}



    int x = 1;

  

  do    {

    printf("%d\n", x);

    x++;

  while (x <= 10);

      }



    return 0;

}


Comments

Popular posts from this blog

Using Struct C

arrays in c programming

for loop with index in C