My C program doesn't seem to be working correctly, output is completely off . Basically the program is suppose to output amount of characters, amount of word and amount of newlines that have been typed. Multiple consecutive spaces should not be counted as multiple words. Any ideas?
Code:#include <stdio.h> void main () { char c=0; int num_words=0, num_chars=0, num_newlines=0; while ((c=getchar()) !=4); num_chars++; printf("Number of Characters: %d",num_chars); if (num_chars==10)//ASCII code of space { num_words++; printf("Number of words: %d",num_words); } else (num_chars==32); { num_newlines++; printf("Number of newlines: %d",num_newlines); } }