0

I want print ten times hello world. But with one second intervals. In C language.

13th Aug 2020, 6:52 PM
Hasan Kuluk
3 odpowiedzi
+ 3
hasan here is an example by GeeksforGeeks but on SoloLearn the delay doesn't seem to work... #include <stdio.h> // To use time library of C #include <time.h> void delay(int seconds){ // Converting time into milli_seconds int mil = 1000 * seconds; // Storing start time clock_t stime = clock(); // looping till required time is not achieved while (clock() < stime + mil);} // Driver code to test above function int main(){ int i; for(i = 0; i < 10; i++){ delay(1); printf("under normal circumstances %d seconds have passed\n", i + 1);} return 0;}
13th Aug 2020, 7:51 PM
BroFar
BroFar - avatar
+ 2
Martin Taylor thanks for pointing out my error above ( corrected )... 👍
13th Aug 2020, 10:13 PM
BroFar
BroFar - avatar