sugandha-kadp / Hacktoberfest2021-Task4

For Biggingers
6 stars 45 forks source link

make errors factorial code #27

Open chamz99 opened 2 years ago

DharaniKarunarathna commented 2 years ago

include

using namespace std;

int main() { int i, n, factorial = 1;

cout<<"Enter a positive integer: ";
cin>>n;

for (i = 1; i <= n; ++i) {
    factorial *= i;   // factorial = factorial * i;
}
cout<< "Factorial of "<<n<<" = "<<factorial;

return 0;

}

DharaniKarunarathna commented 2 years ago

include

using namespace std;

int main() { int i, n, factorial = 1;

cout<<"Enter a positive integer: ";
cin>>n;

for (i = 1; i <= n; ++i) {
    factorial *= i;   // factorial = factorial * i;
}
cout<< "Factorial of "<<n<<" = "<<factorial;

return 0;

}

sugandha-kadp commented 2 years ago

@DharaniKarunarathna you can send PR