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
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
0
Answer:
this is your answer please give me thanks
Attachments:
Similar questions
Math,
1 month ago
Hindi,
1 month ago
India Languages,
1 month ago
Computer Science,
2 months ago
English,
2 months ago
Physics,
8 months ago
Science,
8 months ago
Math,
8 months ago