String to Integer
...
char cs[] = "123";
int num = atoi(cs);
delimited string
...
char str[] = "I am student";
char *ptr;
ptr = strtok(str, " ");
while (ptr != NULL) {
print("%s",ptr);
//输出每一个字符/字符串
ptr = strtok(NULL, " ");
}
The console determines the number of input integers, and counts the number of odd and even numbers after inputting integers
int n ,num,odd=0,even=0;
scanf("%d",&n);
for(int i =0;i<n;i++){
scanf("%d",&num);
if((num%2)!=0) {
++odd;
}
else {
++even;
}
}
printf("%d %d",odd,even);