//This program contains a new command for the Printf function. More Explanation is given in line 12. #include #include void main( ) { //*** Variable Declaration *** int count=0; char x,y; //*** The Main Body *** clrscr(); printf("This program will count the number of characters in a given statement.\nNote that the program will continue until you enter \"0\".\n"); //The \" command in the previous line, will print the quotation mark on the screen. printf("\nenter your statement please:\n"); while (x!='0') { scanf("%c",&x); count++; } printf("\nThe number of characters in your statement is: %d",count); getch(); /* The following lines will check the value of x after the end of the program. This test shows the function of scanf, while we enter a string instead of a single character. By entering a string, all the characters will be scanned and saved in the defined variable respectively (x in this program). But each time, the scanned character will be replaced by the next character of the string. */ printf("\n\nChecking the value of variable x:\n"); printf("%c",x); getch(); }