Syntax

import java.*;
import java.io.*;
import java.util.*;

class for_loop
{
 public static void main(String arg[])
  {
   int fact=1;
   Scanner sc= new Scanner(System.in);
   System.out.println("Enter Any Number : ");
    int n = sc.nextInt();
     for(int i=1; i<=n;i++)
     {
	  fact = fact * i;
	  }
	System.out.println("Factorial of "+n+" is "+fact);   
   }
}	


OUTPUT

Enter Any Number : 
5
Factorial of 5 is 120

See How to Implement This Program :
please Subscribed this tutorial to : Click here

Leave a Reply

Subscribe to Posts | Subscribe to Comments

All Notes on BCA

All Notes  on BCA
BCA all subjects notes

Total Pageviews

Translate

Powered by Blogger.

Copyright © All Notes on BCA