138k views
16 votes
WAP to read number(s) from keyboard until a zero number is keyed in. And print the sum of entered numbers.​

User Abram
by
5.0k points

2 Answers

11 votes

Answer and Explanation:

in Java:

import java.util.Scanner;

public class NumberReader

{

public static void main(String[]args)

{

Scanner in = new Scanner(System.in);

int keyNum = 10;

while (keyNum != 0)

{

keyNum = in.nextInt();

sum += keyNum

}

System.out.println(sum);

}

}

User Rkrauter
by
4.8k points
2 votes

Answer:

Worship And Pray -LIVE LAUGH WAP

User RMuesi
by
5.1k points