#include<iostream>
using namespace std;
int main()
{
int n ,a,d,sum;
cout<<"enter the value of a"<<endl;
cin>>a;
cout<<"enter the vlaue of d"<<endl;
cin>>d;
cout<<"enter the value of n"<<endl;
cin>>n;
sum=(n)/(2)*((2*a)+(n-1)*(d));
cout<<"sum="<<sum;
return 0;
}
No comments:
Post a Comment