Write an algorithm and draw flow chart to find the sum of 10 numbers supplied using the standard input by using do while loop
Answers
Answered by
0
Answer:
import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int sum = 0 , i = 0;
System.out.println("Enter all 10 numbers-");
do{
int x = sc.nextInt();
sum = sum + x;
i++;
}while(i < 10);
System.out.println("The sum of all 10 numbers is " + sum);
}
Explanation:
Similar questions
Social Sciences,
26 days ago
Social Sciences,
26 days ago
Math,
26 days ago
Chemistry,
1 month ago
Computer Science,
1 month ago
English,
9 months ago