SlideShare a Scribd company logo
1 of 4
Download to read offline
import java.util.Scanner;
public class ArrayOperation {
/* input method implementation */
public static double[] input() {
Scanner sc = new Scanner(System.in);
System.out.println("Please enter the size of array");
int n = sc.nextInt();
double number[] = new double[n];
/* Inserting element to array */
for (int i = 0; i < n; i++) {
number[i] = sc.nextDouble();
}
/* printing array by calling print method */
print(number);
return number;
}
public static void print(double number[]) {
/* Printing array */
for (int i = 0; i < number.length; i++) {
System.out.print(number[i] + " ");
}
System.out.println();
}
/* sqrtnumber method implemantation */
public static void sqrtNumber(double number[]) {
/* Printing sqrt of numbers */
System.out.println("Square root of Number of an array");
for (int i = 0; i < number.length; i++) {
double num = Math.sqrt(number[i]);
System.out.println(num);
}
}
public static void main(String args[]) {
/* Calling initaize array */
double number[] = input();
/* calling sqrtnumber */
sqrtNumber(number);
}
}
/***********output*****************/
Please enter the size of array
5
5
6
7
8
14
5.0 6.0 7.0 8.0 14.0
Square root of Number of an array
2.23606797749979
2.449489742783178
2.6457513110645907
2.8284271247461903
3.7416573867739413
Solution
import java.util.Scanner;
public class ArrayOperation {
/* input method implementation */
public static double[] input() {
Scanner sc = new Scanner(System.in);
System.out.println("Please enter the size of array");
int n = sc.nextInt();
double number[] = new double[n];
/* Inserting element to array */
for (int i = 0; i < n; i++) {
number[i] = sc.nextDouble();
}
/* printing array by calling print method */
print(number);
return number;
}
public static void print(double number[]) {
/* Printing array */
for (int i = 0; i < number.length; i++) {
System.out.print(number[i] + " ");
}
System.out.println();
}
/* sqrtnumber method implemantation */
public static void sqrtNumber(double number[]) {
/* Printing sqrt of numbers */
System.out.println("Square root of Number of an array");
for (int i = 0; i < number.length; i++) {
double num = Math.sqrt(number[i]);
System.out.println(num);
}
}
public static void main(String args[]) {
/* Calling initaize array */
double number[] = input();
/* calling sqrtnumber */
sqrtNumber(number);
}
}
/***********output*****************/
Please enter the size of array
5
5
6
7
8
14
5.0 6.0 7.0 8.0 14.0
Square root of Number of an array
2.23606797749979
2.449489742783178
2.6457513110645907
2.8284271247461903
3.7416573867739413

More Related Content

Similar to import java.util.Scanner;public class ArrayOperation {    inp.pdf

Star pattern programs in java Print Star pattern in java and print triangle ...
Star pattern programs in java Print Star pattern in java and  print triangle ...Star pattern programs in java Print Star pattern in java and  print triangle ...
Star pattern programs in java Print Star pattern in java and print triangle ...Hiraniahmad
 
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.pdfoptokunal1
 
(JAVA NetBeans) Write a Java program able to perform selection sort-So.docx
(JAVA NetBeans) Write a Java program able to perform selection sort-So.docx(JAVA NetBeans) Write a Java program able to perform selection sort-So.docx
(JAVA NetBeans) Write a Java program able to perform selection sort-So.docxdorisc7
 
SumNumbers.java import java.util.Scanner;public class SumNumbe.pdf
SumNumbers.java import java.util.Scanner;public class SumNumbe.pdfSumNumbers.java import java.util.Scanner;public class SumNumbe.pdf
SumNumbers.java import java.util.Scanner;public class SumNumbe.pdfankkitextailes
 
JAVA Question : Programming Assignment
JAVA Question : Programming AssignmentJAVA Question : Programming Assignment
JAVA Question : Programming AssignmentCoding Assignment Help
 
java program assigment -2
java program assigment -2java program assigment -2
java program assigment -2Ankit Gupta
 
import java.util.; public class DecimalToBinary { public stat.pdf
import java.util.; public class DecimalToBinary { public stat.pdfimport java.util.; public class DecimalToBinary { public stat.pdf
import java.util.; public class DecimalToBinary { public stat.pdfanithareadymade
 
Digits.javapackage week04;import java.util.Scanner; public cla.pdf
Digits.javapackage week04;import java.util.Scanner; public cla.pdfDigits.javapackage week04;import java.util.Scanner; public cla.pdf
Digits.javapackage week04;import java.util.Scanner; public cla.pdfannapurnnatextailes
 
KOLEJ KOMUNITI - Sijil Aplikasi Perisian Komputer
KOLEJ KOMUNITI - Sijil Aplikasi Perisian KomputerKOLEJ KOMUNITI - Sijil Aplikasi Perisian Komputer
KOLEJ KOMUNITI - Sijil Aplikasi Perisian KomputerAiman Hud
 
ArrayOperations.java import java.util.Arrays; import java.util.pdf
ArrayOperations.java import java.util.Arrays; import java.util.pdfArrayOperations.java import java.util.Arrays; import java.util.pdf
ArrayOperations.java import java.util.Arrays; import java.util.pdfANANDSALESINDIA105
 
I need to create a data type that implement the following interface -.docx
I need to create a data type that implement the following interface -.docxI need to create a data type that implement the following interface -.docx
I need to create a data type that implement the following interface -.docxmckerliejonelle
 
PrimeRange.java import java.util.Scanner;public class PrimeRan.pdf
PrimeRange.java import java.util.Scanner;public class PrimeRan.pdfPrimeRange.java import java.util.Scanner;public class PrimeRan.pdf
PrimeRange.java import java.util.Scanner;public class PrimeRan.pdfAnkitchhabra28
 
Write a program that obtains the execution time of selection sort, bu.pdf
Write a program that obtains the execution time of selection sort, bu.pdfWrite a program that obtains the execution time of selection sort, bu.pdf
Write a program that obtains the execution time of selection sort, bu.pdfarri2009av
 
Throwing.javaimport java.util.InputMismatchException; import jav.pdf
Throwing.javaimport java.util.InputMismatchException; import jav.pdfThrowing.javaimport java.util.InputMismatchException; import jav.pdf
Throwing.javaimport java.util.InputMismatchException; import jav.pdfaquazac
 
Hi, Please find my codeimport java.util.Random;public class Pro.pdf
Hi, Please find my codeimport java.util.Random;public class Pro.pdfHi, Please find my codeimport java.util.Random;public class Pro.pdf
Hi, Please find my codeimport java.util.Random;public class Pro.pdfanujsharmaanuj14
 

Similar to import java.util.Scanner;public class ArrayOperation {    inp.pdf (18)

Java file
Java fileJava file
Java file
 
Star pattern programs in java Print Star pattern in java and print triangle ...
Star pattern programs in java Print Star pattern in java and  print triangle ...Star pattern programs in java Print Star pattern in java and  print triangle ...
Star pattern programs in java Print Star pattern in java and print triangle ...
 
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 NetBeans) Write a Java program able to perform selection sort-So.docx
(JAVA NetBeans) Write a Java program able to perform selection sort-So.docx(JAVA NetBeans) Write a Java program able to perform selection sort-So.docx
(JAVA NetBeans) Write a Java program able to perform selection sort-So.docx
 
SumNumbers.java import java.util.Scanner;public class SumNumbe.pdf
SumNumbers.java import java.util.Scanner;public class SumNumbe.pdfSumNumbers.java import java.util.Scanner;public class SumNumbe.pdf
SumNumbers.java import java.util.Scanner;public class SumNumbe.pdf
 
Java programs
Java programsJava programs
Java programs
 
JAVA Question : Programming Assignment
JAVA Question : Programming AssignmentJAVA Question : Programming Assignment
JAVA Question : Programming Assignment
 
java program assigment -2
java program assigment -2java program assigment -2
java program assigment -2
 
import java.util.; public class DecimalToBinary { public stat.pdf
import java.util.; public class DecimalToBinary { public stat.pdfimport java.util.; public class DecimalToBinary { public stat.pdf
import java.util.; public class DecimalToBinary { public stat.pdf
 
Digits.javapackage week04;import java.util.Scanner; public cla.pdf
Digits.javapackage week04;import java.util.Scanner; public cla.pdfDigits.javapackage week04;import java.util.Scanner; public cla.pdf
Digits.javapackage week04;import java.util.Scanner; public cla.pdf
 
KOLEJ KOMUNITI - Sijil Aplikasi Perisian Komputer
KOLEJ KOMUNITI - Sijil Aplikasi Perisian KomputerKOLEJ KOMUNITI - Sijil Aplikasi Perisian Komputer
KOLEJ KOMUNITI - Sijil Aplikasi Perisian Komputer
 
ArrayOperations.java import java.util.Arrays; import java.util.pdf
ArrayOperations.java import java.util.Arrays; import java.util.pdfArrayOperations.java import java.util.Arrays; import java.util.pdf
ArrayOperations.java import java.util.Arrays; import java.util.pdf
 
I need to create a data type that implement the following interface -.docx
I need to create a data type that implement the following interface -.docxI need to create a data type that implement the following interface -.docx
I need to create a data type that implement the following interface -.docx
 
PrimeRange.java import java.util.Scanner;public class PrimeRan.pdf
PrimeRange.java import java.util.Scanner;public class PrimeRan.pdfPrimeRange.java import java.util.Scanner;public class PrimeRan.pdf
PrimeRange.java import java.util.Scanner;public class PrimeRan.pdf
 
WAP to add two given matrices in Java
WAP to add two given matrices in JavaWAP to add two given matrices in Java
WAP to add two given matrices in Java
 
Write a program that obtains the execution time of selection sort, bu.pdf
Write a program that obtains the execution time of selection sort, bu.pdfWrite a program that obtains the execution time of selection sort, bu.pdf
Write a program that obtains the execution time of selection sort, bu.pdf
 
Throwing.javaimport java.util.InputMismatchException; import jav.pdf
Throwing.javaimport java.util.InputMismatchException; import jav.pdfThrowing.javaimport java.util.InputMismatchException; import jav.pdf
Throwing.javaimport java.util.InputMismatchException; import jav.pdf
 
Hi, Please find my codeimport java.util.Random;public class Pro.pdf
Hi, Please find my codeimport java.util.Random;public class Pro.pdfHi, Please find my codeimport java.util.Random;public class Pro.pdf
Hi, Please find my codeimport java.util.Random;public class Pro.pdf
 

More from angelsfashion1

The density of water. The shape of protein molecu.pdf
                     The density of water. The shape of protein molecu.pdf                     The density of water. The shape of protein molecu.pdf
The density of water. The shape of protein molecu.pdfangelsfashion1
 
Silica gel is a very polar absorbent, and so ho.pdf
                     Silica gel is a very polar absorbent, and so ho.pdf                     Silica gel is a very polar absorbent, and so ho.pdf
Silica gel is a very polar absorbent, and so ho.pdfangelsfashion1
 
PbI2-Pb2+ and 2I- Molar Concentration of Iodide.pdf
                     PbI2-Pb2+ and 2I-  Molar Concentration of Iodide.pdf                     PbI2-Pb2+ and 2I-  Molar Concentration of Iodide.pdf
PbI2-Pb2+ and 2I- Molar Concentration of Iodide.pdfangelsfashion1
 
NiSO4 as its a weak salt and will not dissociates.pdf
                     NiSO4 as its a weak salt and will not dissociates.pdf                     NiSO4 as its a weak salt and will not dissociates.pdf
NiSO4 as its a weak salt and will not dissociates.pdfangelsfashion1
 
NaCl is ionic compound and polar where as benzene.pdf
                     NaCl is ionic compound and polar where as benzene.pdf                     NaCl is ionic compound and polar where as benzene.pdf
NaCl is ionic compound and polar where as benzene.pdfangelsfashion1
 
No. Sodium lauryl sulfate will not form insoluble.pdf
                     No. Sodium lauryl sulfate will not form insoluble.pdf                     No. Sodium lauryl sulfate will not form insoluble.pdf
No. Sodium lauryl sulfate will not form insoluble.pdfangelsfashion1
 
Moles of H2O = 4.564=6.75 moles .pdf
                     Moles of H2O = 4.564=6.75 moles                .pdf                     Moles of H2O = 4.564=6.75 moles                .pdf
Moles of H2O = 4.564=6.75 moles .pdfangelsfashion1
 
it is ribose and the other is deoxyribose .pdf
                     it is ribose and the other is deoxyribose        .pdf                     it is ribose and the other is deoxyribose        .pdf
it is ribose and the other is deoxyribose .pdfangelsfashion1
 
True.It is a confirmal mapping transforming imaginary axis of s-pl.pdf
True.It is a confirmal mapping transforming imaginary axis of s-pl.pdfTrue.It is a confirmal mapping transforming imaginary axis of s-pl.pdf
True.It is a confirmal mapping transforming imaginary axis of s-pl.pdfangelsfashion1
 
These are two of the three major perspectives on sociology. Each of .pdf
These are two of the three major perspectives on sociology. Each of .pdfThese are two of the three major perspectives on sociology. Each of .pdf
These are two of the three major perspectives on sociology. Each of .pdfangelsfashion1
 
I have no Idea sorry. .pdf
                     I have no Idea sorry.                            .pdf                     I have no Idea sorry.                            .pdf
I have no Idea sorry. .pdfangelsfashion1
 
The main body of the new policy The employees can write blogs to .pdf
The main body of the new policy The employees can write blogs to .pdfThe main body of the new policy The employees can write blogs to .pdf
The main body of the new policy The employees can write blogs to .pdfangelsfashion1
 
The emotional and psychological effects the HIVAIDS epidemic on the.pdf
The emotional and psychological effects the HIVAIDS epidemic on the.pdfThe emotional and psychological effects the HIVAIDS epidemic on the.pdf
The emotional and psychological effects the HIVAIDS epidemic on the.pdfangelsfashion1
 
Specific heat of water = 4.184 Jg.oCHeat released by dissolution .pdf
Specific heat of water = 4.184 Jg.oCHeat released by dissolution .pdfSpecific heat of water = 4.184 Jg.oCHeat released by dissolution .pdf
Specific heat of water = 4.184 Jg.oCHeat released by dissolution .pdfangelsfashion1
 
Solution is simple.Comments added start with calling a funct.pdf
Solution is simple.Comments added start with calling a funct.pdfSolution is simple.Comments added start with calling a funct.pdf
Solution is simple.Comments added start with calling a funct.pdfangelsfashion1
 
Since the gene responsible for the color of pea and shape of seed of.pdf
Since the gene responsible for the color of pea and shape of seed of.pdfSince the gene responsible for the color of pea and shape of seed of.pdf
Since the gene responsible for the color of pea and shape of seed of.pdfangelsfashion1
 
HClO4(aq) appear as H+ (aq) and ClO4 - (aq)Na2SO4.pdf
                     HClO4(aq) appear as H+ (aq) and ClO4 - (aq)Na2SO4.pdf                     HClO4(aq) appear as H+ (aq) and ClO4 - (aq)Na2SO4.pdf
HClO4(aq) appear as H+ (aq) and ClO4 - (aq)Na2SO4.pdfangelsfashion1
 
Questionaccording to this rule of solubility rules most sulfat.pdf
Questionaccording to this rule of solubility rules most sulfat.pdfQuestionaccording to this rule of solubility rules most sulfat.pdf
Questionaccording to this rule of solubility rules most sulfat.pdfangelsfashion1
 
Option (d) is correct. This is because dominant mutation involves si.pdf
Option (d) is correct. This is because dominant mutation involves si.pdfOption (d) is correct. This is because dominant mutation involves si.pdf
Option (d) is correct. This is because dominant mutation involves si.pdfangelsfashion1
 

More from angelsfashion1 (20)

The density of water. The shape of protein molecu.pdf
                     The density of water. The shape of protein molecu.pdf                     The density of water. The shape of protein molecu.pdf
The density of water. The shape of protein molecu.pdf
 
SrCl2 So.pdf
                     SrCl2                                      So.pdf                     SrCl2                                      So.pdf
SrCl2 So.pdf
 
Silica gel is a very polar absorbent, and so ho.pdf
                     Silica gel is a very polar absorbent, and so ho.pdf                     Silica gel is a very polar absorbent, and so ho.pdf
Silica gel is a very polar absorbent, and so ho.pdf
 
PbI2-Pb2+ and 2I- Molar Concentration of Iodide.pdf
                     PbI2-Pb2+ and 2I-  Molar Concentration of Iodide.pdf                     PbI2-Pb2+ and 2I-  Molar Concentration of Iodide.pdf
PbI2-Pb2+ and 2I- Molar Concentration of Iodide.pdf
 
NiSO4 as its a weak salt and will not dissociates.pdf
                     NiSO4 as its a weak salt and will not dissociates.pdf                     NiSO4 as its a weak salt and will not dissociates.pdf
NiSO4 as its a weak salt and will not dissociates.pdf
 
NaCl is ionic compound and polar where as benzene.pdf
                     NaCl is ionic compound and polar where as benzene.pdf                     NaCl is ionic compound and polar where as benzene.pdf
NaCl is ionic compound and polar where as benzene.pdf
 
No. Sodium lauryl sulfate will not form insoluble.pdf
                     No. Sodium lauryl sulfate will not form insoluble.pdf                     No. Sodium lauryl sulfate will not form insoluble.pdf
No. Sodium lauryl sulfate will not form insoluble.pdf
 
Moles of H2O = 4.564=6.75 moles .pdf
                     Moles of H2O = 4.564=6.75 moles                .pdf                     Moles of H2O = 4.564=6.75 moles                .pdf
Moles of H2O = 4.564=6.75 moles .pdf
 
it is ribose and the other is deoxyribose .pdf
                     it is ribose and the other is deoxyribose        .pdf                     it is ribose and the other is deoxyribose        .pdf
it is ribose and the other is deoxyribose .pdf
 
True.It is a confirmal mapping transforming imaginary axis of s-pl.pdf
True.It is a confirmal mapping transforming imaginary axis of s-pl.pdfTrue.It is a confirmal mapping transforming imaginary axis of s-pl.pdf
True.It is a confirmal mapping transforming imaginary axis of s-pl.pdf
 
These are two of the three major perspectives on sociology. Each of .pdf
These are two of the three major perspectives on sociology. Each of .pdfThese are two of the three major perspectives on sociology. Each of .pdf
These are two of the three major perspectives on sociology. Each of .pdf
 
I have no Idea sorry. .pdf
                     I have no Idea sorry.                            .pdf                     I have no Idea sorry.                            .pdf
I have no Idea sorry. .pdf
 
The main body of the new policy The employees can write blogs to .pdf
The main body of the new policy The employees can write blogs to .pdfThe main body of the new policy The employees can write blogs to .pdf
The main body of the new policy The employees can write blogs to .pdf
 
The emotional and psychological effects the HIVAIDS epidemic on the.pdf
The emotional and psychological effects the HIVAIDS epidemic on the.pdfThe emotional and psychological effects the HIVAIDS epidemic on the.pdf
The emotional and psychological effects the HIVAIDS epidemic on the.pdf
 
Specific heat of water = 4.184 Jg.oCHeat released by dissolution .pdf
Specific heat of water = 4.184 Jg.oCHeat released by dissolution .pdfSpecific heat of water = 4.184 Jg.oCHeat released by dissolution .pdf
Specific heat of water = 4.184 Jg.oCHeat released by dissolution .pdf
 
Solution is simple.Comments added start with calling a funct.pdf
Solution is simple.Comments added start with calling a funct.pdfSolution is simple.Comments added start with calling a funct.pdf
Solution is simple.Comments added start with calling a funct.pdf
 
Since the gene responsible for the color of pea and shape of seed of.pdf
Since the gene responsible for the color of pea and shape of seed of.pdfSince the gene responsible for the color of pea and shape of seed of.pdf
Since the gene responsible for the color of pea and shape of seed of.pdf
 
HClO4(aq) appear as H+ (aq) and ClO4 - (aq)Na2SO4.pdf
                     HClO4(aq) appear as H+ (aq) and ClO4 - (aq)Na2SO4.pdf                     HClO4(aq) appear as H+ (aq) and ClO4 - (aq)Na2SO4.pdf
HClO4(aq) appear as H+ (aq) and ClO4 - (aq)Na2SO4.pdf
 
Questionaccording to this rule of solubility rules most sulfat.pdf
Questionaccording to this rule of solubility rules most sulfat.pdfQuestionaccording to this rule of solubility rules most sulfat.pdf
Questionaccording to this rule of solubility rules most sulfat.pdf
 
Option (d) is correct. This is because dominant mutation involves si.pdf
Option (d) is correct. This is because dominant mutation involves si.pdfOption (d) is correct. This is because dominant mutation involves si.pdf
Option (d) is correct. This is because dominant mutation involves si.pdf
 

Recently uploaded

Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 

Recently uploaded (20)

Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 

import java.util.Scanner;public class ArrayOperation {    inp.pdf

  • 1. import java.util.Scanner; public class ArrayOperation { /* input method implementation */ public static double[] input() { Scanner sc = new Scanner(System.in); System.out.println("Please enter the size of array"); int n = sc.nextInt(); double number[] = new double[n]; /* Inserting element to array */ for (int i = 0; i < n; i++) { number[i] = sc.nextDouble(); } /* printing array by calling print method */ print(number); return number; } public static void print(double number[]) { /* Printing array */ for (int i = 0; i < number.length; i++) { System.out.print(number[i] + " "); } System.out.println(); } /* sqrtnumber method implemantation */ public static void sqrtNumber(double number[]) { /* Printing sqrt of numbers */ System.out.println("Square root of Number of an array"); for (int i = 0; i < number.length; i++) { double num = Math.sqrt(number[i]); System.out.println(num); } } public static void main(String args[]) { /* Calling initaize array */ double number[] = input();
  • 2. /* calling sqrtnumber */ sqrtNumber(number); } } /***********output*****************/ Please enter the size of array 5 5 6 7 8 14 5.0 6.0 7.0 8.0 14.0 Square root of Number of an array 2.23606797749979 2.449489742783178 2.6457513110645907 2.8284271247461903 3.7416573867739413 Solution import java.util.Scanner; public class ArrayOperation { /* input method implementation */ public static double[] input() { Scanner sc = new Scanner(System.in); System.out.println("Please enter the size of array"); int n = sc.nextInt(); double number[] = new double[n]; /* Inserting element to array */ for (int i = 0; i < n; i++) { number[i] = sc.nextDouble(); } /* printing array by calling print method */ print(number);
  • 3. return number; } public static void print(double number[]) { /* Printing array */ for (int i = 0; i < number.length; i++) { System.out.print(number[i] + " "); } System.out.println(); } /* sqrtnumber method implemantation */ public static void sqrtNumber(double number[]) { /* Printing sqrt of numbers */ System.out.println("Square root of Number of an array"); for (int i = 0; i < number.length; i++) { double num = Math.sqrt(number[i]); System.out.println(num); } } public static void main(String args[]) { /* Calling initaize array */ double number[] = input(); /* calling sqrtnumber */ sqrtNumber(number); } } /***********output*****************/ Please enter the size of array 5 5 6 7 8 14 5.0 6.0 7.0 8.0 14.0 Square root of Number of an array 2.23606797749979