Write a program to input two limits and print all the numbers whose sum of digit is 10.
Answers
Answered by
1
Answer:
Use the for-each loop rather than pointing to indexes to make execution fast
public class Arraysum {
public static void main(String[] args) {
int sum=0;
int ar[]=new int[10];
System.out.println("Enter data:");
Scanner sc=new Scanner(System.in);
for(int i=0;i<10;++i)
ar[i]=sc.nextInt();
for(int i:ar)
sum=sum+i;
System.out.println(sum);
}
}
4.8K views
View 4 upvotes
4
Add a comment...
Anjali Patil
, studied at Institute of Science,Nagpur
Answered May 25, 2019
Answered by
0
Answer:
refer the attachment hope it's helpful to you please mark me as brainlist
Attachments:
Similar questions