Roll an N-sided die until the sum of the numbers drawn is greater than X (N and X chosen by the user)
#include <iostream>
using namespace std;
int main()
{
int N,sum=0, X, b;
cout << " Enter number of faces for your dice: ";
cin>>X;
cout<<"\nChoose the starting value for N: ";
cin>>b;
for (N = b; N <= X; N++)
{
cout << N << " ";
sum=sum+N;
}
cout << "\n SUM = : "<<sum << endl;
}
Comments
Leave a comment