#include<iostream>
using namespace std;
int main()

int number;
int counter=1;
int fact=1;
cout<<"enter number \n";
cin>>number;

while(counter<=number)

fact*=counter;
counter++;

cout<<fact<<endl;

how to ask user to repeat

The usual way is with a prompt and inputting a yes or no response. You might want to include a few brace brackets to enclose your main function and while loop.

commented: I try do it but i can't +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.