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 an exception in .net?

512


Explain About .NET Framework

527


What is difference between private and static constructor?

462


In gridview in editmode if we want to display information in one combobox based on

1813


What is .cshtml file?

495






Can you declare a field readonly?

536


What is the different types of private assembly and shared assembly?

495


What is the difference between c and c sharp?

542


What is the compiler of c#?

487


What is difference between comparable and comparator?

460


What is a static class in c#?

504


What is list array in c#?

470


Can we instantiate abstract class in c#?

473


Is list immutable in c#?

483


What is an example of a delegate?

503