Write a program to find the factorial of a given number using for loops in JAVA ( #JAVA )
Question 5 : Write a program to find the factorial of a given number using for loops.
package com.company; import java.util.Scanner; public class Factorial { public static void main (String args[]) { Scanner sc = new Scanner (System.in); System.out.println("Input value of n :"); int n = sc.nextInt(); int fact=1,i; for (i=1;i<=n;i++) { fact= fact * i; } System.out.println("Factorial : " + fact); } // end of main } // end of class
Thanks Dosto for Reading this blog.
I think you all are definitely thinking of being connected with me.
Instagram : https://www.instagram.com/thetechdcode/
Facebook Page : https://www.facebook.com/thetechdcode
Twitter : https://twitter.com/thetechdcode
Telegram Channel : https://t.me/thetechdcode
YouTube : https://www.youtube.com/channel/UCjJnEdeugftBwQ3yMuD4B_A
Tech DCode Linktree : https://linktr.ee/thetechdcode
My Personal Handles : https://linktr.ee/virtualshivamin
Social Media Links of SHIVAM SINGH (OWNER) :
Instagram : https://www.instagram.com/virtualshivamin/
Facebook Page : https://www.facebook.com/virtualshivamin/
Twitter : https://twitter.com/virtualshivamin/
Personal Linktree : https://linktr.ee/virtualshivamin
Check Best Offers/Deals and Discount on Amazon :
Amazon : https://amzn.to/3tLt2FN
Bestsellers : https://amzn.to/31boSuB
New Realeases : https://amzn.to/3rdru5U
Movers and Shakers : https://amzn.to/3lFu5nY
Computer and accessories : https://amzn.to/3lERTbJ
Electronics : https://amzn.to/3sqHW4l
Softwares : https://amzn.to/3ccwAee