From 7cb3ac8281f3ef1c12ec708e72750e49e839877e Mon Sep 17 00:00:00 2001 From: aish2021 <72348510+aish2021@users.noreply.github.com> Date: Thu, 7 Oct 2021 17:07:23 +0530 Subject: [PATCH] Create notenterx.java --- notenterx.java | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 notenterx.java diff --git a/notenterx.java b/notenterx.java new file mode 100644 index 0000000..21dfadf --- /dev/null +++ b/notenterx.java @@ -0,0 +1,36 @@ +// This program takes input till 'x' is not entered and give total sum of all entered values and also give largest entered number. + + +import java.util.*; + +class notenterX{ + public static void main(String arr[]){ + Scanner scan = new Scanner(System.in); + + String n; + int i=0,a; + int large=0; + + while(true){ + System.out.println("Enter values-: "); + n=scan.next(); + if("x".equals(n)) + { + break; + } + else{ + i=i+Integer.parseInt(n); + a=Integer.parseInt(n); + if(large