SlideShare a Scribd company logo
Write a Java application that asks for an integer and returns its factorization into prime factors
including their powers. The prime factors must appear in increasing order. For example if 120 (=
2*2*2*3*5) in the input number, then your program should output 120 = 2^3 * 3^1 * 5^1 The
factors should appear in increasing order and should be separated from each other by asterisks
(*).
Solution
import java.util.Scanner;
public class factorialFactorization {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scan = new Scanner(System.in);
System.out.print("Enter a number:");
int n = scan.nextInt();
int fact=1;
for(int i=2;i<=n;i++)
{
fact = fact*i;
}
int count=0,hat=0;
System.out.print(fact);
System.out.print(" = ");
for(int i=2;fact>1;i++)
{
count = 0;
while(true)
{
if(fact%i==0)
{
count++;
fact = fact/i;
}
else
{
break;
}
}
if(count>0)
{
if(hat>0)
{
System.out.print(" * ");
}
System.out.print(i);
System.out.print("^");
System.out.print(count);
hat ++;
}
}
}
}

More Related Content

Similar to Write a Java application that asks for an integer and returns its fac.pdf

Functional Programming
Functional ProgrammingFunctional Programming
Functional Programming
Olexandra Dmytrenko
 
Java Simple Programs
Java Simple ProgramsJava Simple Programs
Java Simple Programs
Upender Upr
 
Lab01.pptx
Lab01.pptxLab01.pptx
Lab01.pptx
KimVeeL
 
Oot practical
Oot practicalOot practical
Oot practical
Vipin Rawat @ daya
 
the code below is a recommendation system application to suggest a s.pdf
the code below is a recommendation system application to suggest a s.pdfthe code below is a recommendation system application to suggest a s.pdf
the code below is a recommendation system application to suggest a s.pdf
rajatchugh13
 
The sample program for above series in JAVA will be like belowimpo.pdf
The sample program for above series in JAVA will be like belowimpo.pdfThe sample program for above series in JAVA will be like belowimpo.pdf
The sample program for above series in JAVA will be like belowimpo.pdf
rajat630669
 
The sample program for above series in JAVA will be like belowimpo.pdf
The sample program for above series in JAVA will be like belowimpo.pdfThe sample program for above series in JAVA will be like belowimpo.pdf
The sample program for above series in JAVA will be like belowimpo.pdf
rajat630669
 
Base de-datos
Base de-datosBase de-datos
Base de-datos
ferney1428
 
Chapter 7 functions (c)
Chapter 7 functions (c)Chapter 7 functions (c)
Chapter 7 functions (c)
hhliu
 
Assignment Java Programming 2
Assignment Java Programming 2Assignment Java Programming 2
Assignment Java Programming 2
Kaela Johnson
 
Lab101.pptx
Lab101.pptxLab101.pptx
Lab101.pptx
KimVeeL
 
Unit 4 (1)
Unit 4 (1)Unit 4 (1)
Unit 4 (1)
psaravanan1985
 
Java 8 lambda expressions
Java 8 lambda expressionsJava 8 lambda expressions
Java 8 lambda expressions
Logan Chien
 
import java.util.;public class Program{public static void.pdf
import java.util.;public class Program{public static void.pdfimport java.util.;public class Program{public static void.pdf
import java.util.;public class Program{public static void.pdf
optokunal1
 
Java Programs
Java ProgramsJava Programs
Java Programs
AnjaliSoorej
 
Java final lab
Java final labJava final lab
Java final lab
Vivek Kumar Sinha
 
5 Rmi Print
5  Rmi Print5  Rmi Print
5 Rmi Print
varadasuren
 
Java programI made this Account.java below. Using the attached cod.pdf
Java programI made this Account.java below. Using the attached cod.pdfJava programI made this Account.java below. Using the attached cod.pdf
Java programI made this Account.java below. Using the attached cod.pdf
fathimafancy
 
Problemas secuenciales.
Problemas secuenciales.Problemas secuenciales.
Problemas secuenciales.
Erika Susan Villcas
 
Problemas secuenciales.
Problemas secuenciales.Problemas secuenciales.
Problemas secuenciales.
Erika Susan Villcas
 

Similar to Write a Java application that asks for an integer and returns its fac.pdf (20)

Functional Programming
Functional ProgrammingFunctional Programming
Functional Programming
 
Java Simple Programs
Java Simple ProgramsJava Simple Programs
Java Simple Programs
 
Lab01.pptx
Lab01.pptxLab01.pptx
Lab01.pptx
 
Oot practical
Oot practicalOot practical
Oot practical
 
the code below is a recommendation system application to suggest a s.pdf
the code below is a recommendation system application to suggest a s.pdfthe code below is a recommendation system application to suggest a s.pdf
the code below is a recommendation system application to suggest a s.pdf
 
The sample program for above series in JAVA will be like belowimpo.pdf
The sample program for above series in JAVA will be like belowimpo.pdfThe sample program for above series in JAVA will be like belowimpo.pdf
The sample program for above series in JAVA will be like belowimpo.pdf
 
The sample program for above series in JAVA will be like belowimpo.pdf
The sample program for above series in JAVA will be like belowimpo.pdfThe sample program for above series in JAVA will be like belowimpo.pdf
The sample program for above series in JAVA will be like belowimpo.pdf
 
Base de-datos
Base de-datosBase de-datos
Base de-datos
 
Chapter 7 functions (c)
Chapter 7 functions (c)Chapter 7 functions (c)
Chapter 7 functions (c)
 
Assignment Java Programming 2
Assignment Java Programming 2Assignment Java Programming 2
Assignment Java Programming 2
 
Lab101.pptx
Lab101.pptxLab101.pptx
Lab101.pptx
 
Unit 4 (1)
Unit 4 (1)Unit 4 (1)
Unit 4 (1)
 
Java 8 lambda expressions
Java 8 lambda expressionsJava 8 lambda expressions
Java 8 lambda expressions
 
import java.util.;public class Program{public static void.pdf
import java.util.;public class Program{public static void.pdfimport java.util.;public class Program{public static void.pdf
import java.util.;public class Program{public static void.pdf
 
Java Programs
Java ProgramsJava Programs
Java Programs
 
Java final lab
Java final labJava final lab
Java final lab
 
5 Rmi Print
5  Rmi Print5  Rmi Print
5 Rmi Print
 
Java programI made this Account.java below. Using the attached cod.pdf
Java programI made this Account.java below. Using the attached cod.pdfJava programI made this Account.java below. Using the attached cod.pdf
Java programI made this Account.java below. Using the attached cod.pdf
 
Problemas secuenciales.
Problemas secuenciales.Problemas secuenciales.
Problemas secuenciales.
 
Problemas secuenciales.
Problemas secuenciales.Problemas secuenciales.
Problemas secuenciales.
 

More from hadpadrrajeshh

Given a newly created Binary Search Tree with the following numerica.pdf
Given a newly created Binary Search Tree with the following numerica.pdfGiven a newly created Binary Search Tree with the following numerica.pdf
Given a newly created Binary Search Tree with the following numerica.pdf
hadpadrrajeshh
 
Gather information on the following two disasters Space shuttle Ch.pdf
Gather information on the following two disasters Space shuttle Ch.pdfGather information on the following two disasters Space shuttle Ch.pdf
Gather information on the following two disasters Space shuttle Ch.pdf
hadpadrrajeshh
 
Determine the Laplace transform, F(s), of the following time signal..pdf
Determine the Laplace transform, F(s), of the following time signal..pdfDetermine the Laplace transform, F(s), of the following time signal..pdf
Determine the Laplace transform, F(s), of the following time signal..pdf
hadpadrrajeshh
 
Describe the difference between a monitor and a semaphoreSolutio.pdf
Describe the difference between a monitor and a semaphoreSolutio.pdfDescribe the difference between a monitor and a semaphoreSolutio.pdf
Describe the difference between a monitor and a semaphoreSolutio.pdf
hadpadrrajeshh
 
Create a link list. Add some nodes to it, search and delete nodes fro.pdf
Create a link list. Add some nodes to it, search and delete nodes fro.pdfCreate a link list. Add some nodes to it, search and delete nodes fro.pdf
Create a link list. Add some nodes to it, search and delete nodes fro.pdf
hadpadrrajeshh
 
A speedometer is a measuring instrument. What are the independent and.pdf
A speedometer is a measuring instrument. What are the independent and.pdfA speedometer is a measuring instrument. What are the independent and.pdf
A speedometer is a measuring instrument. What are the independent and.pdf
hadpadrrajeshh
 
A recent study by the EPA has determined that the amount of contamin.pdf
A recent study by the EPA has determined that the amount of contamin.pdfA recent study by the EPA has determined that the amount of contamin.pdf
A recent study by the EPA has determined that the amount of contamin.pdf
hadpadrrajeshh
 
choice one correct answerRocks containing iron, calcium, magnesium.pdf
choice one correct answerRocks containing iron, calcium, magnesium.pdfchoice one correct answerRocks containing iron, calcium, magnesium.pdf
choice one correct answerRocks containing iron, calcium, magnesium.pdf
hadpadrrajeshh
 
1.write down the RTL for the SUBT instructions. 2.Draw a flowchart.pdf
1.write down the RTL for the SUBT instructions. 2.Draw a flowchart.pdf1.write down the RTL for the SUBT instructions. 2.Draw a flowchart.pdf
1.write down the RTL for the SUBT instructions. 2.Draw a flowchart.pdf
hadpadrrajeshh
 
Where should seaweeds and kelps be classified Give characteristics .pdf
Where should seaweeds and kelps be classified Give characteristics .pdfWhere should seaweeds and kelps be classified Give characteristics .pdf
Where should seaweeds and kelps be classified Give characteristics .pdf
hadpadrrajeshh
 
What is the name of the connective tissue that divides the se.pdf
What is the name of the connective tissue that divides the se.pdfWhat is the name of the connective tissue that divides the se.pdf
What is the name of the connective tissue that divides the se.pdf
hadpadrrajeshh
 
What is the current ratio of Chester Use the results of the Balance.pdf
What is the current ratio of Chester Use the results of the Balance.pdfWhat is the current ratio of Chester Use the results of the Balance.pdf
What is the current ratio of Chester Use the results of the Balance.pdf
hadpadrrajeshh
 
What is glass-transition temperature Give a material example. How ma.pdf
What is glass-transition temperature Give a material example. How ma.pdfWhat is glass-transition temperature Give a material example. How ma.pdf
What is glass-transition temperature Give a material example. How ma.pdf
hadpadrrajeshh
 
What are some contributions to the development of industrializat.pdf
What are some contributions to the development of industrializat.pdfWhat are some contributions to the development of industrializat.pdf
What are some contributions to the development of industrializat.pdf
hadpadrrajeshh
 
The “creative revolution” that handed more authority to agency art d.pdf
The “creative revolution” that handed more authority to agency art d.pdfThe “creative revolution” that handed more authority to agency art d.pdf
The “creative revolution” that handed more authority to agency art d.pdf
hadpadrrajeshh
 
The three main coefficients (not properties or dimensionless numbers).pdf
The three main coefficients (not properties or dimensionless numbers).pdfThe three main coefficients (not properties or dimensionless numbers).pdf
The three main coefficients (not properties or dimensionless numbers).pdf
hadpadrrajeshh
 
The project will study the coordination of multiple threads using se.pdf
The project will study the coordination of multiple threads using se.pdfThe project will study the coordination of multiple threads using se.pdf
The project will study the coordination of multiple threads using se.pdf
hadpadrrajeshh
 
The positive selection process for T lymphocytes that occurs In the t.pdf
The positive selection process for T lymphocytes that occurs In the t.pdfThe positive selection process for T lymphocytes that occurs In the t.pdf
The positive selection process for T lymphocytes that occurs In the t.pdf
hadpadrrajeshh
 
The local public health agency has received reports of an outbreak o.pdf
The local public health agency has received reports of an outbreak o.pdfThe local public health agency has received reports of an outbreak o.pdf
The local public health agency has received reports of an outbreak o.pdf
hadpadrrajeshh
 
how are musical sounds produced Explain your reasoning.Solution.pdf
how are musical sounds produced Explain your reasoning.Solution.pdfhow are musical sounds produced Explain your reasoning.Solution.pdf
how are musical sounds produced Explain your reasoning.Solution.pdf
hadpadrrajeshh
 

More from hadpadrrajeshh (20)

Given a newly created Binary Search Tree with the following numerica.pdf
Given a newly created Binary Search Tree with the following numerica.pdfGiven a newly created Binary Search Tree with the following numerica.pdf
Given a newly created Binary Search Tree with the following numerica.pdf
 
Gather information on the following two disasters Space shuttle Ch.pdf
Gather information on the following two disasters Space shuttle Ch.pdfGather information on the following two disasters Space shuttle Ch.pdf
Gather information on the following two disasters Space shuttle Ch.pdf
 
Determine the Laplace transform, F(s), of the following time signal..pdf
Determine the Laplace transform, F(s), of the following time signal..pdfDetermine the Laplace transform, F(s), of the following time signal..pdf
Determine the Laplace transform, F(s), of the following time signal..pdf
 
Describe the difference between a monitor and a semaphoreSolutio.pdf
Describe the difference between a monitor and a semaphoreSolutio.pdfDescribe the difference between a monitor and a semaphoreSolutio.pdf
Describe the difference between a monitor and a semaphoreSolutio.pdf
 
Create a link list. Add some nodes to it, search and delete nodes fro.pdf
Create a link list. Add some nodes to it, search and delete nodes fro.pdfCreate a link list. Add some nodes to it, search and delete nodes fro.pdf
Create a link list. Add some nodes to it, search and delete nodes fro.pdf
 
A speedometer is a measuring instrument. What are the independent and.pdf
A speedometer is a measuring instrument. What are the independent and.pdfA speedometer is a measuring instrument. What are the independent and.pdf
A speedometer is a measuring instrument. What are the independent and.pdf
 
A recent study by the EPA has determined that the amount of contamin.pdf
A recent study by the EPA has determined that the amount of contamin.pdfA recent study by the EPA has determined that the amount of contamin.pdf
A recent study by the EPA has determined that the amount of contamin.pdf
 
choice one correct answerRocks containing iron, calcium, magnesium.pdf
choice one correct answerRocks containing iron, calcium, magnesium.pdfchoice one correct answerRocks containing iron, calcium, magnesium.pdf
choice one correct answerRocks containing iron, calcium, magnesium.pdf
 
1.write down the RTL for the SUBT instructions. 2.Draw a flowchart.pdf
1.write down the RTL for the SUBT instructions. 2.Draw a flowchart.pdf1.write down the RTL for the SUBT instructions. 2.Draw a flowchart.pdf
1.write down the RTL for the SUBT instructions. 2.Draw a flowchart.pdf
 
Where should seaweeds and kelps be classified Give characteristics .pdf
Where should seaweeds and kelps be classified Give characteristics .pdfWhere should seaweeds and kelps be classified Give characteristics .pdf
Where should seaweeds and kelps be classified Give characteristics .pdf
 
What is the name of the connective tissue that divides the se.pdf
What is the name of the connective tissue that divides the se.pdfWhat is the name of the connective tissue that divides the se.pdf
What is the name of the connective tissue that divides the se.pdf
 
What is the current ratio of Chester Use the results of the Balance.pdf
What is the current ratio of Chester Use the results of the Balance.pdfWhat is the current ratio of Chester Use the results of the Balance.pdf
What is the current ratio of Chester Use the results of the Balance.pdf
 
What is glass-transition temperature Give a material example. How ma.pdf
What is glass-transition temperature Give a material example. How ma.pdfWhat is glass-transition temperature Give a material example. How ma.pdf
What is glass-transition temperature Give a material example. How ma.pdf
 
What are some contributions to the development of industrializat.pdf
What are some contributions to the development of industrializat.pdfWhat are some contributions to the development of industrializat.pdf
What are some contributions to the development of industrializat.pdf
 
The “creative revolution” that handed more authority to agency art d.pdf
The “creative revolution” that handed more authority to agency art d.pdfThe “creative revolution” that handed more authority to agency art d.pdf
The “creative revolution” that handed more authority to agency art d.pdf
 
The three main coefficients (not properties or dimensionless numbers).pdf
The three main coefficients (not properties or dimensionless numbers).pdfThe three main coefficients (not properties or dimensionless numbers).pdf
The three main coefficients (not properties or dimensionless numbers).pdf
 
The project will study the coordination of multiple threads using se.pdf
The project will study the coordination of multiple threads using se.pdfThe project will study the coordination of multiple threads using se.pdf
The project will study the coordination of multiple threads using se.pdf
 
The positive selection process for T lymphocytes that occurs In the t.pdf
The positive selection process for T lymphocytes that occurs In the t.pdfThe positive selection process for T lymphocytes that occurs In the t.pdf
The positive selection process for T lymphocytes that occurs In the t.pdf
 
The local public health agency has received reports of an outbreak o.pdf
The local public health agency has received reports of an outbreak o.pdfThe local public health agency has received reports of an outbreak o.pdf
The local public health agency has received reports of an outbreak o.pdf
 
how are musical sounds produced Explain your reasoning.Solution.pdf
how are musical sounds produced Explain your reasoning.Solution.pdfhow are musical sounds produced Explain your reasoning.Solution.pdf
how are musical sounds produced Explain your reasoning.Solution.pdf
 

Recently uploaded

How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
haiqairshad
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
Solutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptxSolutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptx
spdendr
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
สมใจ จันสุกสี
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
imrankhan141184
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Denish Jangid
 
math operations ued in python and all used
math operations ued in python and all usedmath operations ued in python and all used
math operations ued in python and all used
ssuser13ffe4
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
Krassimira Luka
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
MysoreMuleSoftMeetup
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 

Recently uploaded (20)

How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
Solutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptxSolutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptx
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
 
math operations ued in python and all used
math operations ued in python and all usedmath operations ued in python and all used
math operations ued in python and all used
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 

Write a Java application that asks for an integer and returns its fac.pdf

  • 1. Write a Java application that asks for an integer and returns its factorization into prime factors including their powers. The prime factors must appear in increasing order. For example if 120 (= 2*2*2*3*5) in the input number, then your program should output 120 = 2^3 * 3^1 * 5^1 The factors should appear in increasing order and should be separated from each other by asterisks (*). Solution import java.util.Scanner; public class factorialFactorization { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); System.out.print("Enter a number:"); int n = scan.nextInt(); int fact=1; for(int i=2;i<=n;i++) { fact = fact*i; } int count=0,hat=0; System.out.print(fact); System.out.print(" = "); for(int i=2;fact>1;i++) { count = 0; while(true) { if(fact%i==0) { count++; fact = fact/i;