Code mau cpp - Ham de quy tinh tong s
#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;
// vi du : s = 1 + 2 + 3 + 4 + 5 + 6 + 7 ++ n;
int s = 0;
int n = 5;
int i =0;
int HamA(int s,int i)
{
s = s+i;
cout<< "S" << i <<"=" << s << endl;
i++ ;
if(i <= n)
{
HamA(s, i);
}
}
int main()
{
HamA(s, i);
return 0;
}