Saturday, 17 May 2014

JAVA Program to Find the Factorial of a Number

Factorial of a number USING JAVA

A program to accept a number from keyboard and print the Factorial.


//A small java program to calculate the Factorial
import java.util.Scanner;
public class Factorial
{
public static void main(String[] args)
{           final int fact;
             System.out.println("Enter a number to find the Factorial");
             Scanner in = new Scanner(System.in);
             fact=in.nextInt();
             System.out.println( "Factorial of " + fact + " is " + factorial(fact));
}

public static int factorial(int n)
{ 
             int result = 1;
for(int i = 2; i <= n; i++)
result *= i;
return result;
}

}

Output:


Enter a number to find the Factorial
5
Factorial of 5 is 120

63 comments :

  1. Whoa, amazing blog format! How long are you currently blogging for?
    Your site is great, and articles are superb!

    Feel free to visit my website - phentermine diet pills (www.enhancedonlinenews.com)

    ReplyDelete
    Replies
    1. Great Article android based projects

      Java Training in Chennai

      Project Center in Chennai

      Java Training in Chennai

      projects for cse

      The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

      Delete
  2. The expansion of internet and intelligence in business process lead the way to huge volume of data. It is important to maintain and process these data to be efficient in data handling. Hadoop Training in Chennai | Big Data Training in Chennai

    ReplyDelete
    Replies
    1. Great post.Thanks for one marvelous posting! I enjoyed reading it;The information was very useful.Keep the good work going on!!

      ETL Testing training in chennai| SAP MM training in chennai | Informatica training in chennai

      Delete
  3. Excellent post!!! Selenium automation testing tool makes software and web application process lot simpler. Keep on updating your blog with such awesome information. Selenium Course in Chennai

    ReplyDelete
  4. Hi,

    Thank you so much for posting this. I really appreciate your work. Keep it up. Great work!

    http://kosmiktechnologies.com/selenium/

    ReplyDelete
  5. Thanks for sharing your valuable ideas and views, it is very useful for me.. keep rocks...
    Java Training institute in velachery | Java Course in chennai

    ReplyDelete
  6. Thanks for posting this amazing article with impressive content.keep sharing your informative post..
    Best Linux Training Institute in Chennai | No.1 Linux Training Center in Chennai | Red Hat Linux Training Center in Chennai

    ReplyDelete
  7. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.
    aws training in Chennai

    ReplyDelete
  8. Those guidelines additionally worked to become a good way to
    recognize that other people online have the identical fervor like mine
    to grasp great deal more around this condition.

    white label website builder

    ReplyDelete
  9. Nice and good article. It is very useful for me to learn and understand easily...DotNet Project Center in Chennai | DotNet Project Center in Velachery

    ReplyDelete
  10. Your Blog is really awesome with useful and helpful content for us.Thanks for sharing ..keep updating more information.

    AWS Training Institute in Chennai | AWS Certification Training in Velachery | AWS Exam Center in Chennai | AWS Online Exams in Chennai

    ReplyDelete
  11. Very impressive and interesting blog, it was so good to read and useful to improve my knowledge as updated one,keep updating..This Concepts is very nice Thanks for sharing.

    AWS Training Institute in Chennai | AWS Certification Training in Velachery | AWS Exam Center in Chennai | AWS Online Exams in Chennai

    ReplyDelete
  12. Very impressive and interesting blog, this is the best place to get wonderful information thanks much for sharing here...
    Linux Training Institute in Chennai | Linux Training Center in Chennai | Online Training in Chennai | Linux Certification in Chennai

    ReplyDelete
  13. Your blog is really useful for me. Thanks for sharing this useful blog..thanks for your knwoledge share ... superb article ... searching for this content.for so long.
    AWS Training Institute in Chennai | AWS Certification Training in Velachery | AWS Exam Center in Chennai | AWS Online Exams in Chennai

    ReplyDelete
  14. Your blog is very useful for me,thanks for sharing such a wonderful post with useful information.keep updating..
    Python Training Center in Chennai | Python Certification Training in Chennai

    ReplyDelete
  15. Your Blog is really awesome with useful and helpful content for us. Thanks for sharing. Keep updating more information.
    Tally Training Institute in Chennai | Tally Training in Velachery

    ReplyDelete
  16. It is amazing blog and good information... I was improve my knowledge... Thanks for sharing...Your Blog is Nice and informative...Easy to understand...keep updating...

    MatLab Training Institute in Chennai | MatLab Training in Velachery

    ReplyDelete
  17. Impressive blog with lovely information. really very useful article for us thanks for sharing such a wonderful blog...
    AWS Training Institute in Chennai | AWS Certification Training in Chennai | AWS Training in Medavakkam

    ReplyDelete
  18. Good and more informative post... thanks for sharing your ideas and views... keep rocks and updating.........

    PCB Designing Training in Chennai | PCB Training Institute in Chennai | PCB Training in Velachery

    ReplyDelete
  19. This comment has been removed by the author.

    ReplyDelete
  20. Thanks for sharing your interesting blog with informative information.keep updating such a wonderful post..
    AWS Certification Training in Chennai | AWS Training Institute in Chennai | AWS Exam Center in Chennai

    ReplyDelete
  21. Nice Post! It is really interesting to read from the beginning and Keep up the good work and continue sharing like this.

    Linux Certification Training in chennai | Linux Training Institute in Chennai | Linux Exam Center in Chennai

    ReplyDelete
  22. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge.

    MatLab Training Institute in Chennai | MatLab Training in Velachery | MatLab Courses in Medavakkam

    ReplyDelete
  23. Your Blog is really awesome with useful information and informative article.Thanks for sharing such a wonderful and excellent post with us.keep updating such a amazing post..
    ISTQB Certification Training Center in Chennai | ISTQB Certification Exams in Velachery | ISTQB Certification Training in Velachery | ISTQB Certification Exams in Madipakkam

    ReplyDelete
  24. Thanks for sharing your wonderful and very useful information.keep updating such a impressive and attractive blog with interesting content.

    Java Training in Chennai | Java Training in Velachery | Java Training Center in Medvakkam | Java Training in Pallikaranai | Java Courses in Chennai | Java Online Training in Guindy

    ReplyDelete
  25. Good article!!! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging…

    Best UI Path Training Institute in Chennai | Best UI Path Training in Velachery | Best UI Path Certification Training in Pallikaranai

    ReplyDelete
  26. Thanks for sharing your informative blog with useful information,its really very interesting and happy to read your article.keep updating such a wonderful post with us..

    Embedded System Training in Chennai | Embedded Training in Velachery | Embedded Training Institute in Pallikaranai

    ReplyDelete
  27. your Blog is really useful for me,its really very interesting and informative information post.keep updating such an amazing post.
    Linux Certification Training in Chennai | Linux Training Institute in Chennai | Linux Training Center in Adayar | Best Linux Training in Pallikaranai

    ReplyDelete
  28. Your Blog is really amazing,its really very informative content and useful information.Thanks for sharing your wonderful blog.keep updating such a creative knowledge.

    Best Java Training Institute in Chenna | Java Training in Velachery | Best Java Courses in Medavakkam | Java Training Center in Pallikaranai

    ReplyDelete
  29. Your Blog is really amazing,its really useful for me and informative content with helpful information.keep updating such a wonderful post..

    Tally ERP9 Training in Chennai | Best Tally Training in Chennai | Tally Training Center in Pallikaranai | No.1 Tally ERP9 with GST Courses in Velachery

    ReplyDelete
  30. Very informative blog. Helps to gain knowledge about new concepts and techniques.Thanks a lot for sharing this wonderful blog.keep updating such a excellent post..

    Best PCB Design Training in Chennai | No.1 PCB Design Course in Velachery | Best PCB Training in Chennai

    ReplyDelete
  31. Your Blog is really very informative and interesting to read.Thanks for sharing your useful information.keep updating...
    Embedded System Training in Chennai | Embedded Training Institute in Chennai | Embedded Training with IOT in Velachery

    ReplyDelete
  32. Nice blog. Thank you for sharing. The information you shared is very effective for learners I have got some important suggestions from it..
    Python Certification Training Institute in Chennai | Python Training in Chennai | Python Exam Center in Velachery | Python Training in Velachery

    ReplyDelete
  33. It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...

    AWS Certification Training Institute in Chennai | AWS Training Center in Chennai | AWS Certification Training in Velachery

    ReplyDelete
  34. Thanks for sharing this information,this is helpful to me a lot...It is amazing and wonderful to visit your site.

    Web Designing Training Institute in Chennai | Web designing Training in Velachery | Web Design Training Center in Velachery

    ReplyDelete
  35. Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing.
    Best MicroSoft Azure Training Institute in Chennai | Azure Training in Pallikaranai | Best Azure Certification Training in Pallikaranai | Best Azure Training Center in Chennai

    ReplyDelete
  36. This is a great inspiring article.I am pretty much pleased with your good work. You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post..

    Best ISTQB Certification Training in Chennai | No.1 ISTQB Certification Training Center in Chennai | ISTQB Certification Exam Center in Velachery | ISTQB Certification Training in Saidapet

    ReplyDelete
  37. Thank you so much for posting this. I really appreciate your work. Keep it up. Great work! I am really interested to continue reading your blog. You have shared valid info. Waiting for more updates from you.
    AWS Certification Training in Chennai | Best AWS Training Institute in Chennai | No.1 AWS Certification Training in Nanganallur | AWS Training in Velachery

    ReplyDelete
  38. It is awesome and wonderful to visit your site.Thanks for sharing this information,this is useful to me...
    PCB Design Training Institute in Chennai | PCB Designing Training in Velachery | PCB Design in Pallikaranai | PCB Course in Chennai

    ReplyDelete
  39. Good article! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging…
    Python Certification Training in Chennai | Python Training Institute in Velachery | Python Certification Exams in Chennai | Python Exam Center in Chennai

    ReplyDelete
  40. Wow...What an excellent informative blog, really helpful. Thank you so much for sharing such a wonderful article with us.keep updating..

    MatLab Training Institute in Chennai | MatLab Training in Velachery | Matlab Training Center in Chennai | MatLab Courses in Pallikaranai | MatLab Training with Placement in Chennai

    ReplyDelete
  41. I feel really happy to see your blog and look forward to many more entertaining times reading here. Thanks once more for all the details.

    Java Training institute in Chennai | Java Training Center in Chennai | Java Courses in Velachery

    ReplyDelete
  42. It is awesome and wonderful to visit your site.Thanks for sharing your ideas and views... keep rocks and updating........
    Tally ERP9 Training Institute in Chennai | Tally Training Center in Velachery | Tally Training Center in Taramani

    ReplyDelete
  43. It is amazing blog and good information... I was improve my knowledge... Thanks for sharing such a informative and wonderful post...
    Microsoft Azure Certification Training in Chennai | Best Azure Training in Chennai | Best Azure Training Institute in Chennai | Azure Certification Training in Pallikaranai

    ReplyDelete
  44. I have read your blog its very attractive and impressive. I like it your blog.Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge.

    VMware Certification Training in Chennai | VMware Certification Exam Center in Chennai | VMware Exams Center in Taramani | VMware Certification Exams in Chennai

    ReplyDelete
  45. Wow...What an excellent informative blog, really helpful. Thank you so much for sharing such a wonderful post with us.keep updating..
    AWS Certifications in Chennai | AWS Exam Centers in Chennai | AWS Certification Exams in Velachery | AWS Exams in Velachery | AWS Online Exam Center in Velachery

    ReplyDelete
  46. Very informative and interesting blog, it was so good to read and useful to improve my knowledge as updated one,keep updating..This Concepts is very nice Thanks for sharing.
    ISTQB Certification in Chennai | ISTQB Exam Centers in Chennai | Best ISTQB Exams in Velachery

    ReplyDelete
  47. It is really very awesome and wonderful to visit your site.Thanks for sharing your informative blog with us.keep updating such a wonderful post..
    MicroSoft Azure Certification in Chennai | Azure Exam Centers in Velachery | Azure Exam Centers in Madipakkam

    ReplyDelete
  48. Your Blog is really awesome to read and useful for everyone,thanks for sharing such a wonderful article.keep updating..
    AWS Certification Exam Center in Chennai | AWS Exam Center in Velachery | Best AWS Exams in Chennai

    ReplyDelete