Computer Science, asked by wwwmridanshika9016, 11 months ago

Remya is studying in 10th std and she was not good at maths. Her maths teacher asked to find a factorial of the given number. Can you help Remya by writing a program for the same.

Answers

Answered by Yamini1999
0

Answer:

Python 3:

fact=1

n=int(input())

for i in range(1,n+1):

fact=fact*i

print (fact)

C++ :

#include<iostream>

using namespace std

int main()

{

int fact=1,n;

cin>>n;

for(int i=1;i<=n;i++)

{

fact=fact*i

}

cout<<fact<<"\n";

}

Answered by vinaysreenadhnukala
2

Answer:

#include<iostream>

int main(){

 int n,fac=1,i;

 std::cin>>n;

 for(i=1;i<=n;i++){

   fac=fac*i;

 }

 std::cout<<fac;

}

Explanation:

Similar questions