Computer Science, asked by annu110286, 2 months ago

Write a program to accept any 10 numbers. Calculate and print the sum of all positive and negative

number​

Answers

Answered by kaurmanveer1997
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
shivampandey0512: thanks forit
Similar questions