English

Write C++ program to find a factorial of integers from l to 5. - Computer Science 1

Advertisements
Advertisements

Question

Write C++ program to find a factorial of integers from l to 5.

Code Writing
Advertisements

Solution

#include <iostream.h>
void main ()
{
    int fact, i, j;
    fact = 1;
    cout << "Number" << "\t" << "Factorial";
        for (j = 1; j< = 5; j++)
        {
            fact = fact * j;
        }
        cout<<i<<"\t"<<fact<<endl;
    }
shaalaa.com
  Is there an error in this question or solution?
2021-2022 (March) Set 1

APPEARS IN

Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×