i have

#include <stdio.h>

int main()
{
int a;
int b;
    a = 3;
    b = 30;
    while (a < b)
    {
    printf("%d\n crap .....", a);
    a = a + 1;
    }
return 0;

}

i got output

crap .....4
crap .....5
crap .....6
crap .....7
crap .....8
crap .....9
crap .....10
crap .....11
crap .....12
crap .....13
crap .....14
crap .....15
crap .....16
crap .....17
crap .....18
crap .....19
crap .....20
crap .....21
crap .....22
crap .....23
crap .....24
crap .....25
crap .....26
crap .....27
crap .....28
crap .....29

what about if i want

crap.......1

and after one second

crap.......2

yes but how to enter sleep in this file

#include <stdio.h>

int main()
{
int a;
int b;
    a = 3;
    b = 30;
    while (a < b)
    {
    printf("%d\n crap .....", a);
    a = a + 1;
    }
return 0;

}

sory im complete noob

yes but how to enter sleep in this file

#include <stdio.h>
#include <windows.h>

int main()
{
int a;
int b;
    a = 3;
    b = 30;
    while (a < b)
    {
    printf("%d\n crap .....", a);
    a = a + 1;
    Sleep ( 2000 ) ;
    }
return 0;

}

But the thing is that the above code will work only on windows.

I havent as such personally worked on Linux but if you using Linux (like your avatar says i think) then try using the usleep (2000) function (notice the lowercase "s") here the parameter passsed is time in microseconds.

Also dont forget to include the #include <unistd.h> instead of the windows header.

#include <stdio.h>
#include <unistd.h>

int main()
{
int a;
int b;
    a = 3;
    b = 30;
    while (a < b)
    {
    printf("%d\n crap .....", a);
    a = a + 1;
    usleep ( 2000 ) ;
    }
return 0;

}

Hope it helped, by.e

This question has already been answered. Start a new discussion instead.