RosettaCodeData/Task/User-input-Text/C/user-input-text.c

23 lines
418 B
C
Raw Permalink Normal View History

2013-04-11 01:07:29 -07:00
#include <stdio.h>
2014-04-02 16:56:35 +00:00
#include <stdlib.h>
int main(void)
2013-04-11 01:07:29 -07:00
{
2014-04-02 16:56:35 +00:00
// Get a string from stdin
char str[BUFSIZ];
puts("Enter a string: ");
fgets(str, sizeof(str), stdin);
// Get 75000 from stdin
long num;
char buf[BUFSIZ];
do
{
puts("Enter 75000: ");
fgets(buf, sizeof(buf), stdin);
num = strtol(buf, NULL, 10);
} while (num != 75000);
return EXIT_SUCCESS;
2013-04-11 01:07:29 -07:00
}