Write a program to accept any 10 numbers. Calculate and print the sum of all positive and negative
number
Answers
Answered by
1
Answer:
import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
int a;
int sum=0;
System.out.println("enter the 10 number");
for(int i=0;i<10;i++){
Scanner s=new Scanner(System.in);
a=s.nextInt();
sum=sum+a;
}
System.out.println("Sum of 10 number:-" +sum);
}
Explanation:
shivampandey0512:
hv
Similar questions