3 solutions

  • 1
    @ 2025-7-8 10:28:28
    #include<bits/stdc++.h> 
    using namespace std;
    int main()
    {
        int n;
        cin>>n;
        for(int i=1;i<=n;i++)
        {
            if(i%2==0) cout<<i<<' ';
        }
        return 0;
    }
    
    • 1
      @ 2025-7-8 9:47:24
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
          int n,s=0;
          cin>>n;
          for(int i=1;i<=n;i++)
          {
              if(i%2==0) cout<<i<<' ';
          }
          return 0;
      }
      
      • 0
        @ 2024-12-17 20:39:52
        #include<bits/stdc++.h>
        using namespace std;
        int main()
        {
         int n;
         cin>>n;
         int f=1;
         while(f<=n-1)
         {
         	f=f+1;
         	cout<<f<<" ";
         	f++;
         }
         return 0;
        }
        
        • 1

        Information

        ID
        45
        Time
        1000ms
        Memory
        256MiB
        Difficulty
        1
        Tags
        (None)
        # Submissions
        202
        Accepted
        74
        Uploaded By