Computer Science, asked by preethamv, 6 months ago

write a java program to input n integers and find the sum of digits of elemets in an array and display​

Answers

Answered by dattarajshinde44
2

Answer:

import java.util.*;

public class Question {

 public static void main(String[] args) {

  Scanner sc = new Scanner(System.in);

  int n = 10 // the number of times you want to take input ;

  int b = 0;

  int i = 1;

  for (i = 1;i<=n;i++) {

    System.out.println("Enter A Number");

    int a = sc.nextInt();

    b = b+a;

  }

 System.out.println("Sum = "+b);

}

}

Similar questions