-
Language
C
-
Description
It prints "Hello world!" until the user enters "N".
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
int main (void)
{
char key_repeat;
do {
system ("cls");
printf ("Hello world!\n");
putchar ('\n');
printf ("Do you wish to repeat the process? (Y/N): ");
do {
key_repeat = (char) getch();
} while (key_repeat!='y' && key_repeat!='n' && key_repeat!='Y' && key_repeat!='N');
putchar ('\n');
} while (key_repeat=='y' || key_repeat=='Y');
return EXIT_SUCCESS;
}
#include <stdlib.h>
#include <conio.h>
int main (void)
{
char key_repeat;
do {
system ("cls");
printf ("Hello world!\n");
putchar ('\n');
printf ("Do you wish to repeat the process? (Y/N): ");
do {
key_repeat = (char) getch();
} while (key_repeat!='y' && key_repeat!='n' && key_repeat!='Y' && key_repeat!='N');
putchar ('\n');
} while (key_repeat=='y' || key_repeat=='Y');
return EXIT_SUCCESS;
}