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

MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 

Recently uploaded (20)

MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 

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