Question:

Turbo c++ 3.0 help?

by  |  earlier

0 LIKES UnLike

Can someone help me to make a program that compute the factorial.

 Tags:

   Report

2 ANSWERS


  1. #include <iostream>

    using namespace std;

    int main()

    {

    int number=0;

    int fact = 1;

    cout << "Enter your number; ";

    cin >> number;

    for (int i=1 ; i <= number ; i++) { fact *= i;}

    cout << "The factorial is: " << fact;

    return 0;

    }


  2. #include<stdio.h>

    void factorial()

    {

      int number,factorial,temp=1;

    printf("Enter the Number:");

    scanf("%d", &number);

    while(number>0)

    {

      temp=temp*number;

    --number;

    }

    factorial=temp;

    printf("\nThe factorial of number is:%d",factorial);

    }

    int main()

    {

      factorial();

    return 0;

    }
You're reading: Turbo c++ 3.0 help?

Question Stats

Latest activity: earlier.
This question has 2 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.