write code for Factorial?

Answer Posted / diana cheriyan

Using System;
Namespace FactNmspce
{
Class FactCls
{
Public Static Void Main(String[]args)
{
int i,n,fact=1;
Console.WriteLine("Enter Number");
n=int.Parse(Console.ReadLine());
for(i=1;i<=n;i++)
{
fact=fact*i;
}
Console.WriteLine("Factorial is {0}",fact);
}
}
}

Is This Answer Correct ?    12 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is default class in c#?

505


Are there functions in c#?

509


What is disconnected data architecture in c#?

482


What does char mean in c#?

500


How many types of interface are there in c#?

476






What does do in c#?

542


How long has c# been around?

567


Where are value types stored in c#?

517


What is an enumerator in c#?

520


What is a byte in c#?

555


What is string class in c#?

489


What is tryparse c#?

493


How does array sort work?

500


What are the types in c#?

505


What are modifiers in c#?

471