新的不能再新的手 2023-12-02 22:27 采纳率: 84.6%
浏览 4
已结题

这怎么做呢,哪个人会,祝你暴富

img


就是不会,看不太懂怎样实现题目要求的输出
,而且用哪个结构实现我也不太懂,写了好几次了都有错误

  • 写回答

2条回答 默认 最新

  • zsr旺财97 2023-12-02 22:32
    关注

    用选择结构做 问一下,?和1之间有空格吗

    #include <stdio.h>
    #include <iostream>
    using namespace std;
    int main(){
        int n;
        cin>>n;
        if(n%2==0&&n%3==0){
            printf("%d divisible by 2 and 3? 1\n",n);
        }
        else{
            printf("%d divisible by 2 and 3? 0\n",n);
        }
        if(n%2==0||n%3==0){
            printf("%d divisible by 2 or 3? 1\n",n);
        }
        else{
            printf("%d divisible by 2 or 3? 0\n",n);
        }
        if((n%2!=0||n%3!=0)&&(n%2==0||n%3==0)){
            printf("%d divisible by 2 or 3,but not both?? 1",n);
        }
        else{
            printf("%d divisible by 2 or 3,but not both? 0",n);
        }
            
        return 0;
    }
    
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论 编辑记录
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 12月10日
  • 已采纳回答 12月2日
  • 创建了问题 12月2日