#include<iostream>
using namespace std;
int main() {
/**DEKLARASI**/
int n,a,b;
float Sn;
/*ALGORITMA*/
cout<<"PROGRAM MENGHITUNG JUMLAH N SUKU"<<endl;
cout<<"n="; cin>>n;
cout<<"a="; cin>>a;
cout<<"b="; cin>>b;
Sn=(n*(2*a+(n-1)*b))/2;
cout<<"Jumlah suku="<<Sn<<endl;
system("PAUSE");
}
No comments:
Post a Comment