my code stock.com

Gonzalo Benoffi

Estructura del while
by Gonzalo Benoffi

Snippet options

Download: Download snippet as estructura-del-while.c.
Copy snippet: For this you need a free my code stock.com account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

#include <stdio.h>
#include <stdlib.h>

int main()
{
    char seguir = 's';
    int limite = 5 ;
    int indice = 0;

    /*

    //mientras se cumpla esta/s condiciones
    while ( ( seguir == 's') && (indice < limite) )
    {
        //bloque que se va a repetir
        printf("hola! \n");
        indice = indice + 1 ;
        printf("desea continuar ?\n");
        fflush(stdin);
        scanf("%c",&seguir);
    }

    */

     while ( ( seguir == 's') )
    {
        //bloque que se va a repetir
        printf("hola! \n");
        //siempre buscar que la variable de control se "rompa" o sea que cambie
        printf("desea continuar ?\n");
        fflush(stdin);
        scanf("%c",&seguir);
    }

    printf("fin del while \n");

    return 0;
}

Create a free my code stock.com account now.

my code stok.com is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.