Dear all,
There is some errors in the code that I can’t seem to spot.
The code is
# include <iostream>
using namespace std;
int main ()
{
int N; // Declaring and initializing variables
int n=0;
int i=0;
int fact=1;
cout << "Please Enter an Integer" << endl; // The prompt
cin >> N; // To read from the keyboard
// Part a
if (N==1 || N==0)
{ cout << "The Factorial of " << N << " = 1" << endl; } // Because it's known that the fact. of 0/1 = 1
while (N>1 && i>=0)
{ fact = fact * (N-i);
i = i+1;
}
cout << "The factorial of " << N << " = " << fact << endl;
// Part b
for ( int sigma=0; n=0 || n<=N ; n++)
{ sigma = sigma + (n*n);
}
return 0;
}
and the question is attached