3 solutions

  • 1
    @ 2024-12-7 14:36:48

    #include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int cnt=0; if(n%30) { cout<<3<<" "; cnt++; } if(n%50) { cout<<5<<" "; cnt++; } if(n%70) { cout<<7<<" "; cnt++; } if(cnt0) { cout<<"n"; } return 0; }

    • 1
      @ 2024-12-7 14:17:43
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
          int n;
          cin>>n;
          int cnt=0;
          if(n%3==0)
          {
              cout<<3<<" ";
              cnt++;
          }
          if(n%5==0)
          {
              cout<<5<<" ";
              cnt++;
          }
          if(n%7==0)
          {
              cout<<7<<" ";
              cnt++;
          }
          if(cnt==0)
          {
              cout<<"n";
          }
          return 0;
      }
      
      • 0
        @ 2024-12-17 20:35:29
        #include<bits/stdc++.h>
        using namespace std;
        int main()
        {
        int f;
        cin>>f;
        if(f%3==0&f%5==0&&f%7==0)
        {
        	cout<<3<<" "<<5<<" "<<7;
        }
        else if(f%3==0&&f%5==0)
        {
        	cout<<3<<" "<<5;
        }
        else if(f%5==0&&f%7==0)
        {
        	cout<<5<<" "<<7;
        }
        else if(f%3==0&&f%7==0)
        {
        	cout<<3<<" "<<7;
        }
        else if(f%3==0)
        {
        	cout<<3;
        }
        else if(f%5==0)
        {
        	cout<<5;
        }
        else if(f%7==0)
        {
        	cout<<7;
        }
        else
        {
        	cout<<'n';
        }
        return 0;
        }
        
        • 1

        Information

        ID
        860
        Time
        1000ms
        Memory
        256MiB
        Difficulty
        1
        Tags
        (None)
        # Submissions
        214
        Accepted
        72
        Uploaded By