import java.util.Scanner;
public class simple
{
public static void main(String args[]){
double fnum , snum = 0,sum = 0;
Scanner ip = new Scanner(System.in);
System.out.println("enter the number:");
fnum = ip.nextDouble();
do{
System.out.println("enter more numbers:");
snum = ip.nextDouble();
}
while(fnum > 0);
do{
System.out.println("total number is:");
sum = fnum + snum;
}
while(fnum ==0);
}
}
It's not adding the input numbers.Ii want to run this using while(hasnext)
?
Thanks for helping.