Click the Follow Button

c ; how to use while loop

 

#include<stdio.h>

/*
int counter = 0;
counter = counter + 1;
other way - counter += 1; this is called synctactic sugar
other way - counter ++;
to minus - counter --;
*/
int main()
{
// lets meow 3 times
// while loop

// int counter = 3;
// while (counter > 0)
// {
//     printf("meow\n");
//     counter --;
// }

// int counter = 0;
// while (counter < 3)
// {
//     printf("meow\n");
//     counter ++;
// }

int i = 0;
while (i < 3)
{
    printf("meow\n");
    i = i + 1;
}

}

Comments

Popular Posts

TIC - TAC - TOE

Prime and not prime number

do_while loop is to do something again and again