In c, I want to input multiple line of text, like this: ahxjehxx Fjdbcjdjs Dhshs
ID: 3743515 • Letter: I
Question
In c, I want to input multiple line of text, like this: ahxjehxx Fjdbcjdjs Dhshsjsjs DhdhcdjMy program will end when it meets , and count how many lines? For this question is 4 and give me the number of how many characters.
Thanks In c, I want to input multiple line of text, like this: ahxjehxx Fjdbcjdjs Dhshsjsjs Dhdhcdj
My program will end when it meets , and count how many lines? For this question is 4 and give me the number of how many characters.
Thanks ahxjehxx Fjdbcjdjs Dhshsjsjs Dhdhcdj
My program will end when it meets , and count how many lines? For this question is 4 and give me the number of how many characters.
Thanks
Explanation / Answer
#include #include int main() { char str[1000]; int lines = 0, total = 0; while(scanf("%s", str) != EOF) { total += strlen(str); lines++; } printf("Number of lines = %d ", lines); printf("Number of characters = %d ", total); return 0; }Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.