}
for(int i = 0;i< 5;i++)
{
if(a[i] % 2 != 0)
{
printf("%d ",a[i]);
}
else
{
continue;
}
}
return 0;
}
3:输入一个数,然后把这个数放到一个数组中
int main()
{
unsigned int a;
printf("input a number less than 65536\n");
scanf("%d",&a);//
int b[5];
b[0] = a / 10000;
printf("第一位为:%d\n",b[0]);
b[1] = (a - b[0] * 10000) / 1000;
printf("第二位为:%d\n",b[1]);
b[2] = (a - b[0] * 10000 - b[1] * 1000) / 100;
printf("第三位为:%d\n",b[2]);
b[3] = (a - b[0] * 10000 - b[1] * 1000 - b[2] * 100) / 10;
printf("第四位为:%d\n",b[3]);
b[4] = a - b[0] * 10000 - b[1] * 1000 - b[2] * 100 - b[3] * 10;
printf("第五位为:%d\n",b[4]);
return 0;
}
4:输入一个字符串,然后返回一个整数,就是返回所有的ascll码
#include <string.h>
#include <stdio.h>
int main()
{
char* p = "abcd";
int b = strlen(p);
printf("the length is:%d\n",b);
int a[20];
int i = 0;