1 solutions

  • 0
    @ 2025-11-5 19:22:58

    C :

    #include<stdio.h>
    int main()
    {
        int x;
        scanf("%d",&x);
        if(x<1) printf("%d\n",x);
        else if(x<10) printf("%d\n",2*x-1);
        else printf("%d\n",3*x-11);
        return 0;
    }
    
    

    C++ :

    #include<iostream>
    using namespace std;
    int main()
    {
      int x,y;
      cin>>x;
      if(x<1)
        y=x;
      else if(x<10)
        y=2*x-1;
        else
        y=3*x-11;
        cout<<y<<endl;
      return 0;
    }
    
    • 1

    C语言程序设计教程(第三版)课后习题5.5

    Information

    ID
    19316
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By