输入一个字符串,有大小写,有数字,其中,下标为偶数并且该字符的ASCII码值为奇数的删除
标准输入:
1A2B3cefD4
标准输出
A2BcfD4
代码
#include<stdio.h>
#include<string.h>
char s[1000];
char s2[1000];
int main()
{
int n,i,j=0;
gets(s);
n=strlen(s);
for(i=0;i<n;i++)
{
if(i%2!=0||s[i]%2==0&&i%2==0)
{
s2[j]=s[i];
j++;
}
}
puts(s2);
return 0;
}