if(ch == ''')
{
word_len++;
}
Run Code Online (Sandbox Code Playgroud)
如何指定何时ch等于'它添加一个word_len?似乎我只能使用上面的代码来指定它.
#include <stdio.h>
#include <math.h>
long factcalc(int num1);
int main(void)
{
int num1;
long factorial;
int d;
int out;
printf("Please enter a number that is greater than 0");
scanf_s("%d", &num1);
if (num1 < 0) {
printf("Error, number has to be greater than 0");
} else if (num1 == 0) {
printf("\nThe answer is 1");
} else {
factorial = factcalc(num1);
printf("\nThe factorial of your number is\t %ld", factorial);
}
return 0;
}
long factcalc(int num1)
{
int factorial = 1;
int …Run Code Online (Sandbox Code Playgroud)