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
History,
1 month ago
Chemistry,
3 months ago
Computer Science,
3 months ago
Math,
11 months ago
English,
11 months ago