java - Small addition to current code -


  आयात करें java.util.Scanner; पब्लिक क्लास लाइनकॉन्टर {सार्वजनिक स्थिर शून्य मुख्य (स्ट्रिंग [] आर्ग्स) {System.out.print ("पूर्णांक की रेखा प्रविष्ट करें"); स्कैनर हेलीकॉप्टर = नया स्कैनर (System.in); Int x = हेलिकॉप्टर.एक्सआईटी (); जबकि (हेलिकॉप्टर.hasNextInt ()) {System.out.println (हेलिकॉप्टर.एक्सआईटीआईएनटी ()); मैं जावा के बुनियादी ज्ञान सीखने वाले एक सीएस 1 वर्ग में हूं और एक त्वरित प्रश्न पूछना है, इस कोड पर कोई मुझे बता सकता है कि मैं इसे कैसे प्राप्त कर सकता हूं कि कितने पूर्णांक में टाइप किया गया? आपका समय लूप के ऊपर धन्यवाद   

घोषित करें:

  int count = 0;   

तब आपके समय में लूप का उपयोग गिनती ++;

यह आपको 0 पर प्रारंभ करेगा और हर बार यह गिनती बढ़ता

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

Installing croogo for cakephp -

c# - Use custom conventions when persisting Rebus sagas in MongoDb -