Computer Science, asked by geetanagar2509, 5 months ago

WAP to accept numbers from the user, stop when user enters 0. Display sum of it.

Answers

Answered by priya7668
0

Answer:

I'm only writing main program with the help of java language...

//to input no.

int n =Integer.parseInt(br.readline());

int s=0;

while(true) // here it means infinite loop

{

//for sum

s=s+n;

if(n=0)

System.out.print(+s);

break; // it came out of loop

else

n=0; // this is to initialise the value as null.so,that user can again input any no. and then this value will overwrite...

}

HOPE IT WILL HELP YOU!

Similar questions