1 solutions

  • 0
    @ 2025-11-5 16:33:07

    C++ :

    #include<bits/stdc++.h>
    using namespace std;
    int a[105],n,s=1;
    int main()
    {
    	cin>>n;
    	a[1]=1;
    	for(int i=2;i<=n;i++)
    	{
    	 	a[i]=a[i-1]+4;
    	 	s+=a[i];
    	}
    	cout<<s;
       return 0;
    }
    
    

    Pascal :

    var a,b,c:longint;
    begin
      readln(a);
      b:=3;
      for c:=1 to a do
          begin
            b:=b+4;
          end;
      writeln(b);
    end.
    
    • 1

    Information

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