Computer Science, asked by tavishsk, 2 months ago

single dimensional arrays (JAVA BLUE J)

Create an array of size 10. Automatically fill the array with the factorial of number between 1 to 10, and then display the content of array.
Using only Scanner class instead of buffered reader.

Answers

Answered by mssobihabib74
1

Answer:

import java.io.DataInputStream;

import java.io.IOException;

public class ques1

{

public static void arr() throws IOException

{

DataInputStream in = new DataInputStream(System.in);

int n[] = new int[10];

for(int i = 0;i<10;i++)

{

System.out.print ("Enter a number : ");

n[i] = Integer.parseInt ( in.readLine() );

}

int evenSum = 0,oddSum = 0;

for(int i = 0;i<10;i++)

{

if(i%2 = = 0)

oddSum = oddSum+n[i];

else

evenSum = evenSum+n[i];

}

System.out.println ("Sum of ODD Location : " + oddSum);

System.out.println ("Sum of EVEN Location : " + evenSum);

}

}

hope you got it the answer.......

Answered by sqq4567
0

Answer:

this is your answer please give me thanks

Attachments:
Similar questions