1 / 4
Nov 2023
#include<iostream>
using namespace std;
int fact(int);
int fact (int n){
    int i,f=1;
    for(i=1;i<=n;i++)
    {
        f=f*i;
    }
    return f;
}
int main(){
    int n,m;
    cout<<"Enter number"<<endl;
    cin>>n;
    m=fact(n);
    cout<<"Factorial of a number is"<<m<<endl;
    return 0;
}
  • created

    Nov '23
  • last reply

    Nov '23
  • 3

    replies

  • 287

    views

  • 3

    users

  • 2

    likes

  • 1

    link

If compiles for me too using C++ 4.3.2 and C++ 14.

What compiler shows the error, and what is the error it shows?