SlideShare a Scribd company logo
1 of 1
Download to read offline
Implement the following flowchart in java. Start Request integer k from user Generate data
Write data to "output.txt" Stop no Generate Data Method let n let a array of ers of size n
Solution
import java.util.*;
import java.lang.*;
import java.io.*;
import java.nio.file.*;
import java.io.FileWriter;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
//write to file called output.txt
FileWriter fw = new FileWriter("output.txt");
Scanner in = new Scanner(System.in);
int k = in.nextInt();
int []arr = new int[k];
int n = 0;
while(n

More Related Content

More from JUSTSTYLISH3B2MOHALI

Explain the data component of social media information systems (SMIS).pdf
Explain the data component of social media information systems (SMIS).pdfExplain the data component of social media information systems (SMIS).pdf
Explain the data component of social media information systems (SMIS).pdf
JUSTSTYLISH3B2MOHALI
 
You are to simulate a dispatcher using a priority queue system in C+.pdf
You are to simulate a dispatcher using a priority queue system in C+.pdfYou are to simulate a dispatcher using a priority queue system in C+.pdf
You are to simulate a dispatcher using a priority queue system in C+.pdf
JUSTSTYLISH3B2MOHALI
 
Write a program that accepts an arithmetic expression of unsigned in.pdf
Write a program that accepts an arithmetic expression of unsigned in.pdfWrite a program that accepts an arithmetic expression of unsigned in.pdf
Write a program that accepts an arithmetic expression of unsigned in.pdf
JUSTSTYLISH3B2MOHALI
 
What is the theory of public debt managementSolution1. Sove.pdf
What is the theory of public debt managementSolution1. Sove.pdfWhat is the theory of public debt managementSolution1. Sove.pdf
What is the theory of public debt managementSolution1. Sove.pdf
JUSTSTYLISH3B2MOHALI
 
This is a three part question. For each part the answer requires ide.pdf
This is a three part question. For each part the answer requires ide.pdfThis is a three part question. For each part the answer requires ide.pdf
This is a three part question. For each part the answer requires ide.pdf
JUSTSTYLISH3B2MOHALI
 
The term liberalism, when applied to governments, is very different .pdf
The term liberalism, when applied to governments, is very different .pdfThe term liberalism, when applied to governments, is very different .pdf
The term liberalism, when applied to governments, is very different .pdf
JUSTSTYLISH3B2MOHALI
 
These are the 4 functions #include KiostreamP using namespac.pdf
These are the 4 functions #include KiostreamP using namespac.pdfThese are the 4 functions #include KiostreamP using namespac.pdf
These are the 4 functions #include KiostreamP using namespac.pdf
JUSTSTYLISH3B2MOHALI
 
C++ Bank Account Error Fix, full code. I am using Dev-C++ to Compile.pdf
C++ Bank Account Error Fix, full code. I am using Dev-C++ to Compile.pdfC++ Bank Account Error Fix, full code. I am using Dev-C++ to Compile.pdf
C++ Bank Account Error Fix, full code. I am using Dev-C++ to Compile.pdf
JUSTSTYLISH3B2MOHALI
 

More from JUSTSTYLISH3B2MOHALI (20)

Explain the data component of social media information systems (SMIS).pdf
Explain the data component of social media information systems (SMIS).pdfExplain the data component of social media information systems (SMIS).pdf
Explain the data component of social media information systems (SMIS).pdf
 
Figure CWhich structure in the cell shown in Figure C above stores.pdf
Figure CWhich structure in the cell shown in Figure C above stores.pdfFigure CWhich structure in the cell shown in Figure C above stores.pdf
Figure CWhich structure in the cell shown in Figure C above stores.pdf
 
Coral reefs. How sensitive to changes in water temperature are coral .pdf
Coral reefs. How sensitive to changes in water temperature are coral .pdfCoral reefs. How sensitive to changes in water temperature are coral .pdf
Coral reefs. How sensitive to changes in water temperature are coral .pdf
 
•0.336 moles of a weak, monoproticacid added to a final volume of 2..pdf
•0.336 moles of a weak, monoproticacid added to a final volume of 2..pdf•0.336 moles of a weak, monoproticacid added to a final volume of 2..pdf
•0.336 moles of a weak, monoproticacid added to a final volume of 2..pdf
 
You are to simulate a dispatcher using a priority queue system in C+.pdf
You are to simulate a dispatcher using a priority queue system in C+.pdfYou are to simulate a dispatcher using a priority queue system in C+.pdf
You are to simulate a dispatcher using a priority queue system in C+.pdf
 
Write a program that accepts an arithmetic expression of unsigned in.pdf
Write a program that accepts an arithmetic expression of unsigned in.pdfWrite a program that accepts an arithmetic expression of unsigned in.pdf
Write a program that accepts an arithmetic expression of unsigned in.pdf
 
Why was the knowledge of macromolecules “structure” very important i.pdf
Why was the knowledge of macromolecules “structure” very important i.pdfWhy was the knowledge of macromolecules “structure” very important i.pdf
Why was the knowledge of macromolecules “structure” very important i.pdf
 
Why did the sovereign debt problem of Greece a country that accounts.pdf
Why did the sovereign debt problem of Greece a country that accounts.pdfWhy did the sovereign debt problem of Greece a country that accounts.pdf
Why did the sovereign debt problem of Greece a country that accounts.pdf
 
Which of the following could be the most likely cause of a superi.pdf
Which of the following could be the most likely cause of a superi.pdfWhich of the following could be the most likely cause of a superi.pdf
Which of the following could be the most likely cause of a superi.pdf
 
What is the theory of public debt managementSolution1. Sove.pdf
What is the theory of public debt managementSolution1. Sove.pdfWhat is the theory of public debt managementSolution1. Sove.pdf
What is the theory of public debt managementSolution1. Sove.pdf
 
This is a three part question. For each part the answer requires ide.pdf
This is a three part question. For each part the answer requires ide.pdfThis is a three part question. For each part the answer requires ide.pdf
This is a three part question. For each part the answer requires ide.pdf
 
Complete a personal SWOT analysis evaluating your understanding and .pdf
Complete a personal SWOT analysis evaluating your understanding and .pdfComplete a personal SWOT analysis evaluating your understanding and .pdf
Complete a personal SWOT analysis evaluating your understanding and .pdf
 
this case 2. Suppose a country with a history of high inflation is.pdf
this case 2. Suppose a country with a history of high inflation is.pdfthis case 2. Suppose a country with a history of high inflation is.pdf
this case 2. Suppose a country with a history of high inflation is.pdf
 
The term liberalism, when applied to governments, is very different .pdf
The term liberalism, when applied to governments, is very different .pdfThe term liberalism, when applied to governments, is very different .pdf
The term liberalism, when applied to governments, is very different .pdf
 
These are the 4 functions #include KiostreamP using namespac.pdf
These are the 4 functions #include KiostreamP using namespac.pdfThese are the 4 functions #include KiostreamP using namespac.pdf
These are the 4 functions #include KiostreamP using namespac.pdf
 
The beliefs, customs, values, structure, normative rules, and materi.pdf
The beliefs, customs, values, structure, normative rules, and materi.pdfThe beliefs, customs, values, structure, normative rules, and materi.pdf
The beliefs, customs, values, structure, normative rules, and materi.pdf
 
Can prisoners, young children, mentally disabled adults, or the seve.pdf
Can prisoners, young children, mentally disabled adults, or the seve.pdfCan prisoners, young children, mentally disabled adults, or the seve.pdf
Can prisoners, young children, mentally disabled adults, or the seve.pdf
 
Can we know if we have a soul What about other people or animals.pdf
Can we know if we have a soul What about other people or animals.pdfCan we know if we have a soul What about other people or animals.pdf
Can we know if we have a soul What about other people or animals.pdf
 
C++ Bank Account Error Fix, full code. I am using Dev-C++ to Compile.pdf
C++ Bank Account Error Fix, full code. I am using Dev-C++ to Compile.pdfC++ Bank Account Error Fix, full code. I am using Dev-C++ to Compile.pdf
C++ Bank Account Error Fix, full code. I am using Dev-C++ to Compile.pdf
 
137. The statistic that divides the distribution in two is theA. M.pdf
137. The statistic that divides the distribution in two is theA. M.pdf137. The statistic that divides the distribution in two is theA. M.pdf
137. The statistic that divides the distribution in two is theA. M.pdf
 

Recently uploaded

Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 

Recently uploaded (20)

Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 

Implement the following flowchart in java. Start Request integer k f.pdf

  • 1. Implement the following flowchart in java. Start Request integer k from user Generate data Write data to "output.txt" Stop no Generate Data Method let n let a array of ers of size n Solution import java.util.*; import java.lang.*; import java.io.*; import java.nio.file.*; import java.io.FileWriter; /* Name of the class has to be "Main" only if the class is public. */ class Codechef { public static void main (String[] args) throws java.lang.Exception { // your code goes here //write to file called output.txt FileWriter fw = new FileWriter("output.txt"); Scanner in = new Scanner(System.in); int k = in.nextInt(); int []arr = new int[k]; int n = 0; while(n