ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1083. Factorials!!!

Compilation Error..Please help
Posted by Shalini Sah 31 Dec 2010 13:00
I have written this code in C++, and its running fine in Bloodshed DEV C++ and code::blocks. Then why am i getting compilation error whenever i submit it? Please help.

#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
    int n,j=0,i,m,r;
    long long fact=1;
    char space,c;
    n=getch();
    n=n-48;
    cout<<n;
    space=getche();
    c=getche();

    while(c=='!')
    {
                 c=getche();
                      j++;
    }
    cout<<endl;
    if(n%j==0)
    {
              i=0;
              m=n;
              while(m>=j)
              {
                                 fact=fact*m;
                                 i++;
                                 m=(n-(i*j));
              }
    }
    else
    {
        i=0;
        m=n;
        r=n%j;
              while(m>=r)
              {
                                 fact=fact*m;
                                 i++;
                                 m=(n-(i*j));
              }
    }
    cout<<fact<<"\n";
    system("pause");
    return 0;
}

Thanks in advance.

Regards,
Shalini Sah