#include <iostream>
#include <conio>
void main()
{

   int n;

   cout<<"Enter value of n:";
   cin>>n;

   if(n>=0)&&(n<=10)
    {
    {
    if(n==0)
    Zfactorial=1;
    cout<<"/t/tThe value of Zfactorial for n"<<Zfactorial;
    else(n>0)!!(n<11)
    for(int n=0;n<11;n--)
    Zfactorial=Zfactorial*(n);
    cout<<"/t/tThe value of Zfactorial for n"<<Zfactorial;
    }
   else
   cout<<"Invalid value of n";
    continue
    }


getch();
}

question
Professor Zoe has come up with the formula to calculate the Zfactorial of an integer. The symbol ‘#’ (a hash mark) indicates a Zfactorial defined as follows in Figure 1:

1 if n =0

n# =
[n * (n-1) * (n-2) * ... * 1] * n if 0 < n <=10


Figure 1: Zfactorial Definition
A program accepts an input n of type integer and computes the n Zfactorial. Before the computation, the program should checks the range of n is in between 0 and 10.
(0 <= n <= 10)
If the value of n is not in the range, the program will display an appropriate error message and input the value of n again until the user enter the valid value of n.

Nabella Rozili commented: I still dont get it +0

It's all in the for-loop.

It's all in the for-loop.

can tell me more detail

Have you even tried to compile this? It won't, for at least five separate reasons. Do that first, and try to fix all of the build errors. Any you don't understand, please post them here and we'll help.

Don't use "void main()" either.
Use instead, "int main()"

Don't use "void main()" either.
Use instead, "int main()"

i replace int main...but the there are still error....i really need help....

look at this part of your code

for(int n=0;n<11;n--)

What happens to n as the loop goes on? Does n ever become greater than or equal to 11?

Your else statement is also wrong. Have you ever seen else followed by a condition? here is a link for if, else syntax.

i replace int main...but the there are still error....i really need help....

We're glad to help, but you need to give us a little more information. Please post the actual error messages you're getting, and tell us what you don't understand about them.

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.