How to get user input until user presses 9 in C

1 Answer

0 votes
#include <stdio.h>

int main(void) {
    char s[512];

    printf("Enter text: ");
    scanf(" %[^9]*", s);

    printf("%s\n", s);

    return(0);
}





/*
run:

Enter text: c programming 99 c programming 99
c programming

*/

 



answered May 3, 2021 by avibootz

Related questions

...