(1) the while loop is used to implement the required functionality,
(2) using a for loop to achieve the required functionality,
#include
Int main ()
{unsigned char ch, n=0;
For (ch=getchar (); Fill in the blanks with the [[4]]. Fill in the blanks with the [[5]])
{
Fill in the blanks if ([[6]] | | ch>=97 & amp; & Ch<=122) n++;
}
Printf (" n=% d \ n ", n);
Return 0;
}
Is there a big know this how to do?
CodePudding user response:
#includeInt main ()
{
Unsigned char ch, n=0;
While ((ch=getchar ())!='\ r')
{
If ((ch & gt;='a' & amp; & Ch & lt;='z') | | (ch & gt;='A' & amp; & Ch & lt;='Z'))
{
n++;
}
}
Printf (" n=% d \ n ", n);
Return 0;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include
Int main ()
{unsigned char ch, n=0;
For (ch=getchar (); Ch!='\ r'; Ch=ch)
{
If ((ch & gt;=65 & amp; & Ch & lt;=90) | | ch>=97 & amp; & Ch<=122) n++;
}
Printf (" n=% d \ n ", n);
Return 0;
}
CodePudding user response: