1/30_1

#include <stdio.h>
int main()
{
    int n;
    printf("Input an number between 0 and 9\n");
    scanf("%d",&n);
    char ch;
    while((ch=getchar())!='\n')
    {
        putchar(ch-n);
    }
    return 0;
}

#include <stdio.h>
int main()
{
    char c;
    while((c=getchar())!='\n')
    {
        if((c>='a'&&c<='z')||(c>='A'&&c<='Z'))
          {
              if(c>='W'&&c<='Z')
              {
                c='A'+3-('Z'-c);

              }
              else if(c>='w'&&c<='z')
              {
                  c='a'+3-('z'-c);
              }
              else
              {
                  c=c+4;
              }
          }
             putchar(c);
    }

    return 0;
}

#include <stdio.h>

int main()
{
    char c,c1;
    c1=' ';
    while((c=getchar())!='\n')
    {
       if(c==' ')
       {
           if(c1==' ')
           {
               ;
           }
           else
           {
               putchar(c);
           }
       }
       else
       {
           putchar(c);
       }
       c1=c;
    }

    return 0;
}

#include <stdio.h>
int main()
{
    char c;
    int num_A=0,num_B=0,num_C=0,num_O=0;
    while((c=getchar())!='\n')
    {
        switch(c)
        {
        case 'A':
            num_A++;break;
        case 'B':
            num_B++;break;
        case 'C':
            num_C++;break;
        case 'O':
            num_O++;break;
        default :
            ;
        }

    }
    printf("numbers of A is%d B is %d C is %d O is %d\n",num_A,num_B,num_C,num_O);
    return 0;
}

#include <stdio.h>
int main()
{
  int num_all=0,num_space=0,num_num=0,num_alpha=0;
  char c;
  while((c=getchar())!='\n')
  {
      num_all++;
      if(c==' ')
      {
          num_space++;
      }
      if(c>='0'&&c<='9')
      {
          num_num++;
      }
      if(c>='a'&&c<='z')
      {
          num_alpha++;
      }
     if(c>='A'&&c<='Z')
      {
          num_alpha++;
      }
  }
  printf("There is %d characters %d spaces %d numbers %d alphas\n",num_all,num_space,num_num,num_alpha);
    return 0;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值